forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dark mode fixes for Visualize charts, TSVB, and Timelion (elastic#30478)
* Some quicky changes * Fixes dark vs light coloring for TSVB charts * Fix coloring of tooltips and annotations for TSVB * Fix up TSVB Markdown No uses the same base styles as Visualize and Canvas * More fiddling with spacing around filter bar * Fixing dark mode grid and removing hard-coded hex values where possible and adding an alpha channel to those that can’t * more tweaks * removing more `reversed` props * Skip dark mode test for now Since `.reverse` doesn’t exist unless bg is opposite of theme * SASS linter enabled for TSVB * Fix chrome path * Enable sass-lint on Timelion * Enable sass-lint on vislib * Fix more spacing with query bar and enable sass-lint * temp var name update * A frew more files linted * missed a few more hardcoded colors * Addressed PR comments * Changing #rrggbbaa to rgba() For IE
- Loading branch information
Showing
65 changed files
with
357 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import color from 'color'; | ||
import chrome from '../../../ui/public/chrome'; | ||
const IS_DARK_THEME = chrome.getUiSettingsClient().get('theme:darkMode'); | ||
|
||
/** | ||
* Returns true if the color that is passed has low luminosity | ||
*/ | ||
const isColorDark = (c) => { | ||
return color(c).luminosity() < 0.45; | ||
}; | ||
|
||
/** | ||
* Checks to see if the `currentTheme` is dark in luminosity. | ||
* Defaults to checking `theme:darkMode`. | ||
*/ | ||
export const isThemeDark = (currentTheme) => { | ||
let themeIsDark = currentTheme || IS_DARK_THEME; | ||
|
||
// If passing a string, check the luminosity | ||
if (typeof currentTheme === 'string') { | ||
themeIsDark = isColorDark(currentTheme); | ||
} | ||
|
||
return themeIsDark; | ||
}; | ||
|
||
/** | ||
* Checks to find if the ultimate `backgroundColor` is dark. | ||
* Defaults to returning if the `currentTheme` is dark. | ||
*/ | ||
export const isBackgroundDark = (backgroundColor, currentTheme) => { | ||
const themeIsDark = isThemeDark(currentTheme); | ||
|
||
// If a background color doesn't exist or it inherits, pass back if it's a darktheme | ||
if (backgroundColor === undefined || backgroundColor === 'inherit') { | ||
return themeIsDark; | ||
} | ||
|
||
// Otherwise return if the background color has low luminosity | ||
return isColorDark(backgroundColor); | ||
}; | ||
|
||
/** | ||
* Checks to see if `backgroundColor` is the the same lightness spectrum as `currentTheme`. | ||
*/ | ||
export const isBackgroundInverted = (backgroundColor, currentTheme) => { | ||
const backgroundIsDark = isBackgroundDark(backgroundColor, currentTheme); | ||
const themeIsDark = isThemeDark(currentTheme); | ||
return backgroundIsDark !== themeIsDark; | ||
}; | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
@import 'node_modules/@elastic/eui/src/components/form/variables'; | ||
@import 'node_modules/@elastic/eui/src/components/form/mixins'; | ||
|
||
@mixin tvbEditor__repeatingRow { | ||
@mixin tvbEditorRepeatingRow { | ||
background-color: $euiColorLightestShade; | ||
padding: $euiSizeS; | ||
margin-bottom: $euiSizeS; | ||
} | ||
|
||
// SASSTODO: These need to be converted to EUI, | ||
// but they have type errors | ||
@mixin tvbEditor__input { | ||
@include euiFormControlStyle($borderOnly: false, $includeStates: true, $includeSizes: false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
$tvbLineColor: transparentize($euiColorFullShade,0.8); | ||
$tvbLineColorReversed: transparentize($euiColorEmptyShade,0.6); | ||
$tvbLineColor: transparentize($euiColorFullShade, .8); | ||
$tvbLineColorReversed: transparentize($euiColorEmptyShade, .6); | ||
|
||
$tvbTextColor: transparentize($euiColorFullShade,0.6); | ||
$tvbTextColorReversed: transparentize($euiColorEmptyShade,0.4); | ||
$tvbTextColor: transparentize($euiColorFullShade, .6); | ||
$tvbTextColorReversed: transparentize($euiColorEmptyShade, .4); | ||
|
||
$tvbValueColor: transparentize($euiColorFullShade,0.3); | ||
$tvbValueColorReversed: transparentize($euiColorEmptyShade,0.2); | ||
$tvbValueColor: transparentize($euiColorFullShade, .3); | ||
$tvbValueColorReversed: transparentize($euiColorEmptyShade, .2); | ||
|
||
$tvbHoverBackgroundColor: transparentize($euiColorFullShade,0.9); | ||
$tvbHoverBackgroundColorReversed: transparentize($euiColorEmptyShade,0.9); | ||
$tvbHoverBackgroundColor: transparentize($euiColorFullShade, .9); | ||
$tvbHoverBackgroundColorReversed: transparentize($euiColorEmptyShade, .9); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/legacy/core_plugins/metrics/public/components/_color_rules.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.tvbColorRules__rule { | ||
@include tvbEditor__repeatingRow; | ||
@include tvbEditorRepeatingRow; | ||
} |
Oops, something went wrong.