Speed up rendering of table by reducing temporal calls
This commit is contained in:
parent
085dc389ca
commit
f72204c796
7 changed files with 157 additions and 134 deletions
13
frontend/hooks/usePalette.ts
Normal file
13
frontend/hooks/usePalette.ts
Normal 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()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue