forked from opensearch-project/OpenSearch-Dashboards
-
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.
feat: add dark theme (opensearch-project#44)
* feat(theme): add dark theme The Dark Theme is now available. The AxisConfig has now a cleaner styling, splitted by axis or tick styles. Changing a theme is now easier and it's not necessary tied to a darkmode flag. New theme can be added and used on the charts. fix opensearch-project#35 BREAKING CHANGE: The `Theme.AxisConfig` type has a different signature. It now contains `axisTitleStyle`, `axisLineStyle`, `tickLabelStyle` and `tickLineStyle` defined as `TextStyle` or `StrokeStyle` elements. The `Theme` interface is changed in a more flat structure. `darkMode` prop from `Setting` is removed. `theme` prop in `Setting` is now a `Theme` type object, not a `PartialTheme`. You can use `mergeWithDefaultTheme` function to merge an existing theme with a partial one.
- Loading branch information
Showing
32 changed files
with
922 additions
and
473 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// @ts-ignore | ||
import themeDark from '!!style-loader/useable!css-loader!@elastic/eui/dist/eui_theme_dark.css'; | ||
// @ts-ignore | ||
import themeLight from '!!style-loader/useable!css-loader!@elastic/eui/dist/eui_theme_light.css'; | ||
|
||
export function switchTheme(theme: string) { | ||
switch (theme) { | ||
case 'light': | ||
themeDark.unuse(); | ||
themeLight.use(); | ||
return; | ||
case 'dark': | ||
themeLight.unuse(); | ||
themeDark.use(); | ||
return; | ||
} | ||
} |
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
Oops, something went wrong.