palette and themes
This commit is contained in:
70
theme.js
Normal file
70
theme.js
Normal file
@@ -0,0 +1,70 @@
|
||||
import Color from "color";
|
||||
|
||||
|
||||
export const green = '#35D721';
|
||||
export const red = '#DD1A10';
|
||||
export const yellow = '#FFDE00';
|
||||
export const orange = '#F58A00';
|
||||
export const blue = '#1666EB';
|
||||
export const gray = '#969696';
|
||||
export const purple = '#892ABF';
|
||||
export const white = '#FFFFFF';
|
||||
export const black = '#000000';
|
||||
|
||||
// adjust this number upwards to make the TradingView palette brighter and downwards for darker
|
||||
const middleShadeIndex = 5
|
||||
|
||||
const numShades = 20
|
||||
|
||||
function shadesOf(rgb) {
|
||||
const c = new Color(rgb)
|
||||
const lights = []
|
||||
const darks = []
|
||||
const numLightShades = middleShadeIndex + 1
|
||||
const numDarkShades = numShades - numLightShades
|
||||
for (let j=0; j<numLightShades; j++) {
|
||||
const ratio = j/(numLightShades-1);
|
||||
lights.push(c.lighten(ratio).rgb().toString())
|
||||
}
|
||||
// start iteration at 1 because the unaltered color was already included with the lights
|
||||
for (let j=1; j<=numDarkShades; j++) {
|
||||
const ratio = j/numDarkShades;
|
||||
darks.push(c.darken(ratio).rgb().toString())
|
||||
}
|
||||
return [...lights.toReversed(), ...darks]
|
||||
}
|
||||
|
||||
export const greens = shadesOf(green);
|
||||
export const reds = shadesOf(red);
|
||||
export const yellows = shadesOf(yellow);
|
||||
export const oranges = shadesOf(orange);
|
||||
export const blues = shadesOf(blue);
|
||||
export const grays = shadesOf(gray);
|
||||
export const purples = shadesOf(purple);
|
||||
|
||||
export const tvLightTheme = {
|
||||
"color1": blues,
|
||||
"color2": grays,
|
||||
"color3": reds,
|
||||
"color4": greens,
|
||||
"color5": oranges,
|
||||
"color6": purples,
|
||||
"color7": yellows,
|
||||
"white": white,
|
||||
"black": black,
|
||||
}
|
||||
|
||||
export const tvDarkTheme = {
|
||||
"color1": blues,
|
||||
"color2": grays,
|
||||
"color3": reds,
|
||||
"color4": greens,
|
||||
"color5": oranges,
|
||||
"color6": purples,
|
||||
"color7": yellows,
|
||||
"white": white,
|
||||
"black": black,
|
||||
}
|
||||
|
||||
export const tvCustomThemes = {light: tvLightTheme, dark: tvDarkTheme};
|
||||
// console.log('themes', tvLightTheme);
|
||||
Reference in New Issue
Block a user