[Code]: remove uneccessary color convert after upgrade to EUI 9

This commit is contained in:
Fuyao Zhao 2019-03-08 00:57:33 -08:00
parent 6a1fc64c39
commit 57764f3dbd
3 changed files with 22 additions and 47 deletions

View file

@ -39,7 +39,6 @@
"@types/angular": "1.6.50",
"@types/boom": "^7.2.0",
"@types/cheerio": "^0.22.10",
"@types/color-convert": "^1.9.0",
"@types/d3-array": "^1.2.1",
"@types/d3-scale": "^2.0.0",
"@types/d3-shape": "^1.3.1",
@ -191,7 +190,6 @@
"brace": "0.11.1",
"chroma-js": "^1.3.6",
"classnames": "2.2.5",
"color-convert": "^2.0.0",
"concat-stream": "1.5.1",
"constate": "^0.9.0",
"constate-latest": "npm:constate@^1.0.0",

View file

@ -119,44 +119,28 @@ const IS_DARK_THEME = chrome.getUiSettingsClient().get('theme:darkMode');
},
};*/
function getTheme() {
if (IS_DARK_THEME) {
return darkTheme;
} else {
return lightTheme;
}
}
const themeName = getTheme();
function getHex(rgbString: string) {
const colorValues = rgbString.slice(4, -1);
const colorArray = colorValues.split(', ');
// @ts-ignore
return '#' + convert.rgb.hex(Number(colorArray[0]), Number(colorArray[1]), Number(colorArray[2]));
}
const themeName = IS_DARK_THEME ? darkTheme : lightTheme;
const syntaxTheme = {
keyword: getHex(themeName.euiColorAccent),
comment: getHex(themeName.euiColorMediumShade),
delimiter: getHex(themeName.euiColorSecondary),
string: getHex(themeName.euiColorPrimary),
number: getHex(themeName.euiColorWarning),
regexp: getHex(themeName.euiColorPrimary),
types: `${IS_DARK_THEME ? getHex(themeName.euiColorVis5) : getHex(themeName.euiColorVis9)}`,
annotation: getHex(themeName.euiColorLightShade),
tag: getHex(themeName.euiColorAccent),
symbol: getHex(themeName.euiColorDanger),
foreground: getHex(themeName.euiColorDarkestShade),
editorBackground: getHex(themeName.euiColorLightestShade),
lineNumbers: getHex(themeName.euiColorDarkShade),
editorIndentGuide: getHex(themeName.euiColorLightShade),
selectionBackground: getHex(themeName.euiColorLightShade),
editorWidgetBackground: getHex(themeName.euiColorLightestShade),
editorWidgetBorder: getHex(themeName.euiColorLightShade),
findMatchBackground: getHex(themeName.euiColorWarning),
findMatchHighlightBackground: getHex(themeName.euiColorWarning),
keyword: themeName.euiColorAccent,
comment: themeName.euiColorMediumShade,
delimiter: themeName.euiColorSecondary,
string: themeName.euiColorPrimary,
number: themeName.euiColorWarning,
regexp: themeName.euiColorPrimary,
types: `${IS_DARK_THEME ? themeName.euiColorVis5 : themeName.euiColorVis9}`,
annotation: themeName.euiColorLightShade,
tag: themeName.euiColorAccent,
symbol: themeName.euiColorDanger,
foreground: themeName.euiColorDarkestShade,
editorBackground: themeName.euiColorLightestShade,
lineNumbers: themeName.euiColorDarkShade,
editorIndentGuide: themeName.euiColorLightShade,
selectionBackground: themeName.euiColorLightShade,
editorWidgetBackground: themeName.euiColorLightestShade,
editorWidgetBorder: themeName.euiColorLightShade,
findMatchBackground: themeName.euiColorWarning,
findMatchHighlightBackground: themeName.euiColorWarning,
};
monaco.editor.defineTheme('euiColors', {

View file

@ -1719,7 +1719,7 @@
resolved "https://registry.yarnpkg.com/@types/cmd-shim/-/cmd-shim-2.0.0.tgz#c3d81d3c2a51af3c65c19b4f1d493a75abf07a5c"
integrity sha512-WuV5bOQTGxqzewPnJbrDe51I5mnX2wTRYy+PduRuIvSuBWZlxDYD6Qt/f1m5sezxx1yyE9+1wHJ/0sRuNIoFaQ==
"@types/color-convert@*", "@types/color-convert@^1.9.0":
"@types/color-convert@*":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@types/color-convert/-/color-convert-1.9.0.tgz#bfa8203e41e7c65471e9841d7e306a7cd8b5172d"
integrity sha512-OKGEfULrvSL2VRbkl/gnjjgbbF7ycIlpSsX7Nkab4MOWi5XxmgBYvuiQ7lcCFY5cPDz7MUNaKgxte2VRmtr4Fg==
@ -6754,19 +6754,12 @@ color-convert@^1.9.1:
dependencies:
color-name "1.1.3"
color-convert@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.0.tgz#9851ac61cc0d3898a8a3088650d5bf447bf69d97"
integrity sha512-hzTicsCJIHdxih9+2aLR1tNGZX5qSJGRHDPVwSY26tVrEf55XNajLOBWz2UuWSIergszA09/bqnOiHyqx9fxQg==
dependencies:
color-name "~1.1.4"
color-name@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
color-name@^1.0.0, color-name@^1.1.1, color-name@~1.1.4:
color-name@^1.0.0, color-name@^1.1.1:
version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==