Speed up rendering of table by reducing temporal calls

This commit is contained in:
Benji Grant 2023-06-09 01:41:33 +10:00
parent 085dc389ca
commit f72204c796
7 changed files with 157 additions and 134 deletions

View file

@ -0,0 +1,13 @@
import { createPalette } from 'hue-map'
import { useStore } from '/src/stores'
import useSettingsStore from '/src/stores/settingsStore'
export const usePalette = (min: number, max: number) => {
const colormap = useStore(useSettingsStore, state => state.colormap)
return createPalette({
map: (colormap === undefined || colormap === 'crabfit') ? [[0, [247, 158, 0, 0]], [1, [247, 158, 0, 255]]] : colormap,
steps: Math.max((max - min) + 1, 2),
}).format()
}