diff --git a/css/deltagreen.css b/css/deltagreen.css index 43e224f..c94f63c 100644 --- a/css/deltagreen.css +++ b/css/deltagreen.css @@ -45,6 +45,7 @@ /* Override default foundry CSS to remove padding, so that our background image can take up the whole window */ .deltagreen section.window-content { padding: 0 !important; + scrollbar-color: #215112 #111 !important; } /* Override the default Foundry CSS to add the padding we removed from the outer window back in */ @@ -1195,12 +1196,12 @@ input.item-sheet-short-input { */ #interface * { - --color-shadow-primary: #374e13 !important; - --color-shadow-highlight: #406539 !important; - --color-border-highlight: #406539 !important; - --color-border-highlight-alt: #374e13 !important; - --color-underline-header: #406539 !important; - --color-text-dark-header: #406539 !important; + --color-shadow-primary: #215112 !important; + --color-shadow-highlight: #215112 !important; + --color-border-highlight: #215112 !important; + --color-border-highlight-alt: #215112 !important; + --color-underline-header: #215112 !important; + --color-text-dark-header: #215112 !important; scrollbar-color: var(--color-text-dark-header) #111 !important; } diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 3a1c682..9ca1dc1 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -220,15 +220,34 @@ export default class DeltaGreenActorSheet extends ActorSheet { } reorderForColumnSorting(arr, numCols) { - let numRows = Math.ceil(arr.length / numCols); + let numRows = Math.ceil(arr.length / numCols); // Compute required rows let reordered = new Array(arr.length); - for (let i = 0; i < arr.length; i++) { - let row = i % numRows; - let col = Math.floor(i / numRows); - let newIndex = row * numCols + col; + // Determine how many elements each column gets + let baseRowCount = Math.floor(arr.length / numCols); // Minimum rows per column + let extraColumns = arr.length % numCols; // Some columns get an extra row - reordered[newIndex] = arr[i]; + let colHeights = new Array(numCols).fill(baseRowCount); + for (let i = 0; i < extraColumns; i++) { + colHeights[i]++; // Give extra elements to the first N columns + } + + let index = 0; // move through alphabetical array, keeping track of what we've resorted already + + for (let col = 0; col < numCols; col++) { + // need to check if this is a column that has more rows than the others or not + let rowCount = colHeights[col]; + + // loop down the column, filling out it's values from the alphabetical array + for (let row = 0; row < rowCount; row++) { + // calculate the new position for this value by column + let newIndex = numCols * row + col; + + if (newIndex < arr.length) { + reordered[newIndex] = arr[index]; + index++; + } + } } return reordered;