-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic support for experimental theme switching #199748
Changes from 14 commits
8d4b0f7
0bb04e8
e510604
b521f53
c8d090c
6e85833
e385ad2
591948f
e1ae606
591bc4a
7b518a3
ac0c7b6
c9bc309
08efdfb
544b270
deab885
38364d2
a4391ca
9d8c8f6
84b20c7
d721304
e69f313
7b0a622
069b07e
7882da6
4b791f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
|
||
import { createHash } from 'crypto'; | ||
import { PackageInfo } from '@kbn/config'; | ||
import { ThemeVersion } from '@kbn/ui-shared-deps-npm'; | ||
import type { KibanaRequest, HttpAuth } from '@kbn/core-http-server'; | ||
import { type DarkModeValue, parseDarkModeValue } from '@kbn/core-ui-settings-common'; | ||
import type { IUiSettingsClient } from '@kbn/core-ui-settings-server'; | ||
|
@@ -59,7 +58,7 @@ export const bootstrapRendererFactory: BootstrapRendererFactory = ({ | |
|
||
return async function bootstrapRenderer({ uiSettingsClient, request, isAnonymousPage = false }) { | ||
let darkMode: DarkModeValue = false; | ||
const themeVersion: ThemeVersion = 'v8'; | ||
let themeName: string = 'amsterdam'; | ||
|
||
try { | ||
const authenticated = isAuthenticated(request); | ||
|
@@ -72,6 +71,8 @@ export const bootstrapRendererFactory: BootstrapRendererFactory = ({ | |
} else { | ||
darkMode = parseDarkModeValue(await uiSettingsClient.get('theme:darkMode')); | ||
} | ||
|
||
themeName = await uiSettingsClient.get('theme:name'); | ||
} | ||
} catch (e) { | ||
// just use the default values in case of connectivity issues with ES | ||
|
@@ -83,7 +84,7 @@ export const bootstrapRendererFactory: BootstrapRendererFactory = ({ | |
} | ||
|
||
const themeTag = getThemeTag({ | ||
themeVersion, | ||
name: !themeName || themeName === 'amsterdam' ? 'v8' : themeName, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Theme tags should follow the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if the themeName UI setting is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, that's technically correct. We're not expecting This logic exists only to map |
||
darkMode, | ||
}); | ||
const bundlesHref = getBundlesHref(baseHref); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so is v8 still the default theme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct,
v8
is the theme tag of what kibana ships with right now, and we call it Amsterdam. Up to this point themes were versioned by kibana majors and not named, that's why we have thev8
theme (and before that we had thev7
theme) but that's not what we want to do moving forward.The updated approach is to differentiate themes by their name resulting in theme tags like
borealislight
andborealisdark
for the new Borealis theme. For compatibility reasons we decided to keep the theme tags for the current Amsterdam theme the same, sov8light
andv8dark
, and that's why that specific mapping ofamsterdam
theme name tov8
is necessary.