diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-13 18:12:09 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-13 18:12:09 -0500 |
| commit | d0cf30bfa37864db12009c2f561c87f96bd66989 (patch) | |
| tree | 55ce6289283f0367e75790151bea7fed84fcce1d /scripts/theme-studio/test-app-core.mjs | |
| parent | 0495b16fb940e0f573d4655f0a392d5159bcdeff (diff) | |
| download | dotemacs-d0cf30bfa37864db12009c2f561c87f96bd66989.tar.gz dotemacs-d0cf30bfa37864db12009c2f561c87f96bd66989.zip | |
Sort theme studio dropdown colors by lightness
Diffstat (limited to 'scripts/theme-studio/test-app-core.mjs')
| -rw-r--r-- | scripts/theme-studio/test-app-core.mjs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/theme-studio/test-app-core.mjs b/scripts/theme-studio/test-app-core.mjs index 059a50b2..44474d43 100644 --- a/scripts/theme-studio/test-app-core.mjs +++ b/scripts/theme-studio/test-app-core.mjs @@ -59,6 +59,29 @@ test('paletteOptionList: Normal — color choices follow visual column ordering' assert.ok(list.findIndex(([, name]) => name === 'gray') < list.findIndex(([, name]) => name === 'red'), 'later columns stay later'); }); +test('paletteOptionList: Normal — colors within each column are lightest to darkest', () => { + const pal = [ + ['#111111', 'bg', 'ground'], + ['#eeeeee', 'fg', 'ground'], + ['#444444', 'gray-dark', 'gray'], + ['#cccccc', 'gray-light', 'gray'], + ['#888888', 'gray-mid', 'gray'], + ['#330000', 'red-dark', 'red'], + ['#dd8888', 'red-light', 'red'], + ]; + const list = paletteOptionList('', pal, { bg: '#111111', fg: '#eeeeee' }); + assert.deepEqual(list.slice(0, 3).map(([, name]) => name), ['— default —', 'bg', 'fg']); + assert.deepEqual( + list.filter(([, name]) => name.startsWith('gray')).map(([, name]) => name), + ['gray-light', 'gray-mid', 'gray-dark'], + ); + assert.ok(list.findIndex(([, name]) => name === 'gray-dark') < list.findIndex(([, name]) => name === 'red-light'), 'column order is still left-to-right'); + assert.deepEqual( + list.filter(([, name]) => name.startsWith('red')).map(([, name]) => name), + ['red-light', 'red-dark'], + ); +}); + test('paletteOptionList: Boundary — assignment-only ground colors are selectable', () => { const list = paletteOptionList('', [['#67809c', 'blue']], { bg: '#0d0b0a', fg: '#f0fef0' }); assert.ok(list.some(([hex, name]) => hex === '#0d0b0a' && name === 'bg')); |
