Merge pull request #243 from giraugh/main

Sort heat-map colour options alphabetically
This commit is contained in:
Benjamin Grant 2023-03-17 17:04:54 +11:00 committed by GitHub
commit 264d18881c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -17,6 +17,7 @@ import {
} from './Settings.styles'
import locales from '/src/i18n/locales'
import { unhyphenate } from '/src/utils'
// Language specific options
const setDefaults = (lang, store) => {
@ -132,11 +133,9 @@ const Settings = () => {
id="colormap"
options={{
'crabfit': t('options.colormap.classic'),
...Object.fromEntries(Object.keys(maps).map(palette => [
...Object.fromEntries(Object.keys(maps).sort().map(palette => [
palette,
palette.split('-')
.map(w => w[0].toLocaleUpperCase() + w.substring(1).toLocaleLowerCase())
.join(' '),
unhyphenate(palette)
])),
}}
small

View file

@ -30,3 +30,8 @@ export const detect_browser = () => {
if (isFirefox) return 'firefox'
if (isOpera) return 'opera'
}
export const unhyphenate = s =>
s.split('-')
.map(w => w[0].toLocaleUpperCase() + w.substring(1).toLocaleLowerCase())
.join(' ')