mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Enable dark mode in personal settings
This commit is contained in:
@@ -279,8 +279,9 @@ module ApplicationHelper
|
||||
|
||||
def theme_options_for_select
|
||||
[
|
||||
[t('themes.light'), 'light'],
|
||||
[t('themes.light_high_contrast'), 'light_high_contrast']
|
||||
[t("themes.light"), "light"],
|
||||
[t("themes.light_high_contrast"), "light_high_contrast"],
|
||||
[t("themes.dark"), "dark"]
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
--button-primary-bgColor-rest: var(--button--primary-background-color) !important;
|
||||
--button-primary-bgColor-hover: var(--button--primary-background-hover-color) !important;
|
||||
}
|
||||
[data-light-theme=light_high_contrast]{
|
||||
[data-light-theme=light_high_contrast],
|
||||
[data-light-theme=dark] {
|
||||
--avatar-border-color: var(--color-avatar-border);
|
||||
--list-item-hover--border-color: var(--color-action-list-item-default-active-border);
|
||||
--list-item-hover--color: var(--color-fg-default);
|
||||
|
||||
@@ -431,6 +431,7 @@ en:
|
||||
no_results_content_text: Add a new status
|
||||
|
||||
themes:
|
||||
dark: "Dark"
|
||||
light: "Light"
|
||||
light_high_contrast: "Light high contrast"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"theme": {
|
||||
"type": "string",
|
||||
"enum": ["light", "light_high_contrast"]
|
||||
"enum": ["light", "light_high_contrast", "dark"]
|
||||
},
|
||||
"warn_on_leaving_unsaved": {
|
||||
"type": "boolean"
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
|
||||
export const colorModes = {
|
||||
lightHighContrast: 'lightHighContrast',
|
||||
light: 'light',
|
||||
dark: 'dark',
|
||||
};
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@@ -25,6 +26,16 @@ export class ColorsService {
|
||||
}
|
||||
|
||||
public colorMode():string {
|
||||
return document.body.getAttribute('data-light-theme') === 'light_high_contrast' ? colorModes.lightHighContrast : colorModes.light;
|
||||
switch (document.body.getAttribute('data-light-theme')) {
|
||||
case 'light_high_contrast':
|
||||
return colorModes.lightHighContrast;
|
||||
case 'dark':
|
||||
return colorModes.dark;
|
||||
case 'light':
|
||||
return colorModes.light;
|
||||
default: {
|
||||
return colorModes.light;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user