Skip to content

Commit

Permalink
todos
Browse files Browse the repository at this point in the history
- finish de-themeing rendering service
- set mobile color from theme

Signed-off-by: Josh Romero <rmerqg@amazon.com>
  • Loading branch information
joshuarrrr committed Jan 5, 2024
1 parent c424a21 commit 7377ca9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 51 deletions.
3 changes: 0 additions & 3 deletions src/core/server/rendering/rendering_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ export class RenderingService {
startupScriptUrl: `${basePath}/startup.js`,
i18n: i18n.translate,
locale: i18n.getLocale(),
darkMode,
themeVersion,
injectedMetadata: {
version: env.packageInfo.version,
buildNumber: env.packageInfo.buildNum,
Expand All @@ -132,7 +130,6 @@ export class RenderingService {
uiSettings: settings,
},
branding: {
darkMode,
assetFolderUrl: `${uiPublicUrl}/default_branding`,
logo: {
defaultUrl: brandingAssignment.logoDefault,
Expand Down
2 changes: 0 additions & 2 deletions src/core/server/rendering/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export interface RenderingMetadata {
startupScriptUrl: string;
i18n: typeof i18n.translate;
locale: string;
darkMode: boolean;
themeVersion: string;
injectedMetadata: {
version: string;
buildNumber: number;
Expand Down
3 changes: 0 additions & 3 deletions src/core/server/rendering/views/template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ export const Template: FunctionComponent<Props> = ({
<link rel="manifest" href={favicon ? `` : `${uiPublicUrl}/favicons/manifest.json`} />

{/* Ignoring all of the above, Safari picks this one */}
{/* TODO: update color from theme in startup */}
<link
rel="mask-icon"
color="#003553"
Expand All @@ -128,8 +127,6 @@ export const Template: FunctionComponent<Props> = ({
content={favicon ? `` : `${uiPublicUrl}/favicons/browserconfig.xml`}
/>

{/* TODO: set color from theme in startup */}
<meta name="theme-color" content="#ffffff" />
<Styles />

{/* Inject stylesheets into the <head> before scripts so that KP plugins with bundled styles will override them */}
Expand Down
42 changes: 0 additions & 42 deletions src/core/server/rendering/views/theme.ts

This file was deleted.

9 changes: 8 additions & 1 deletion src/legacy/ui/ui_render/bootstrap/startup.js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var rawDarkMode = typeof browserDarkMode.userValue !== 'boolean' ? {{configDarkM

var rawThemeVersion = browserThemeVersion.userValue || '{{configThemeVersion}}'

// TODO: should this reflect config defaults instead?
// TODO: source of truth for mapping should be elsewhere
var darkMode = rawDarkMode ? 'dark' : 'light';
var themeVersion = rawThemeVersion === 'v7' ? 'v7' : 'v8';

Expand All @@ -28,6 +28,13 @@ var themeDefinition = themeSources[themeVersion][darkMode];

var stylesheetTarget = document.querySelector('head meta[name="add-styles-here"]');

var themeColorDom = document.createElement('meta');

themeColorDom.name = 'theme-color';
themeColorDom.content = themeDefinition.euiHeaderBackgroundColor;

document.head.insertBefore(themeColorDom, stylesheetTarget);

var themedStylesDom = document.createElement('style');

themedStylesDom.innerHTML = `
Expand Down

0 comments on commit 7377ca9

Please sign in to comment.