@gedit/theme
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -20,3 +20,3 @@ /******************************************************************************** | ||
*/ | ||
export declare type Color = string | RGBA | HSLA | ColorTransformation; | ||
export type Color = string | RGBA | HSLA | ColorTransformation; | ||
export declare namespace Color { | ||
@@ -23,0 +23,0 @@ function rgba(r: number, g: number, b: number, a?: number): Color; |
@@ -19,3 +19,3 @@ "use strict"; | ||
const navBackgroundColor = '#131417'; | ||
const dropdownBackgroundColor = '#100A22'; | ||
const dropdownBackgroundColor = '#191B1E'; | ||
const lightColor = '#ffffff'; | ||
@@ -510,7 +510,9 @@ const baseLineColor = '#1F2022'; | ||
description: 'Border color of the selected menu item in the menubar.', | ||
}, { | ||
id: 'menu.border', | ||
defaults: {}, | ||
description: 'Border color of menus.', | ||
}, { | ||
}, | ||
/* { | ||
id: 'menu.border', | ||
defaults: {}, | ||
description: 'Border color of menus.', | ||
}, */ | ||
{ | ||
id: 'menu.foreground', | ||
@@ -546,3 +548,3 @@ defaults: { | ||
defaults: { | ||
dark: '#BBBBBB', | ||
dark: 'menu.border', | ||
}, | ||
@@ -549,0 +551,0 @@ description: 'Color of a separator menu item in menus.', |
@@ -8,3 +8,3 @@ export interface LabelIcon { | ||
} | ||
export declare type LabelPart = string | LabelIcon; | ||
export type LabelPart = string | LabelIcon; | ||
export declare class LabelParser { | ||
@@ -11,0 +11,0 @@ /** |
@@ -18,4 +18,5 @@ /******************************************************************************** | ||
import '../../src/browser/style/variables-dark.css'; | ||
import '../../src/browser/style/variables-operation.css'; | ||
export declare const ThemeServiceSymbol: unique symbol; | ||
export declare type ThemeType = 'light' | 'dark' | 'hc'; | ||
export type ThemeType = 'light' | 'dark' | 'hc'; | ||
export interface Theme { | ||
@@ -34,2 +35,3 @@ readonly id: string; | ||
} | ||
export type ThemeMode = 'develop' | 'operation'; | ||
export declare class ThemeService { | ||
@@ -41,4 +43,6 @@ protected _defaultTheme: string | undefined; | ||
private readonly themeChange; | ||
mode: ThemeMode; | ||
readonly onThemeChange: Event<ThemeChangeEvent>; | ||
protected constructor(_defaultTheme?: string | undefined, fallbackTheme?: string); | ||
initModeClassName(): void; | ||
/** | ||
@@ -52,2 +56,4 @@ * The default theme. If that is not applicable, returns with the fallback theme. | ||
getTheme(themeId: string): Theme; | ||
getThemeMode(): ThemeMode; | ||
setThemeMode(mode: ThemeMode): void; | ||
startupTheme(): void; | ||
@@ -54,0 +60,0 @@ loadUserTheme(): void; |
@@ -24,2 +24,3 @@ "use strict"; | ||
// import '../../src/browser/style/variables-bright.useable.css'; | ||
require("../../src/browser/style/variables-operation.css"); | ||
exports.ThemeServiceSymbol = Symbol('ThemeService'); | ||
@@ -32,6 +33,13 @@ class ThemeService { | ||
this.themeChange = new utils_1.Emitter(); | ||
this.mode = 'operation'; | ||
this.onThemeChange = this.themeChange.event; | ||
const global = window; // eslint-disable-line @typescript-eslint/no-explicit-any | ||
global[exports.ThemeServiceSymbol] = this; | ||
this.mode = this.getThemeMode(); | ||
this.initModeClassName(); | ||
} | ||
initModeClassName() { | ||
const documentElement = document.documentElement; | ||
documentElement.className = `${documentElement.className || ''}${this.mode === 'operation' ? ' gedit-operation' : ''}`.trim(); | ||
} | ||
/** | ||
@@ -71,2 +79,11 @@ * The default theme. If that is not applicable, returns with the fallback theme. | ||
} | ||
getThemeMode() { | ||
const mode = window.localStorage.getItem('theme:mode') || 'operation'; | ||
return mode; | ||
} | ||
setThemeMode(mode) { | ||
const m = mode || 'operation'; | ||
window.localStorage.setItem('theme:mode', m); | ||
this.mode = m; | ||
} | ||
startupTheme() { | ||
@@ -73,0 +90,0 @@ const theme = this.getCurrentTheme(); |
{ | ||
"name": "@gedit/theme", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"license": "MIT", | ||
@@ -12,4 +12,4 @@ "main": "lib/browser/index", | ||
"dependencies": { | ||
"@gedit/application-common": "^0.2.7", | ||
"@gedit/utils": "^0.2.7" | ||
"@gedit/application-common": "^0.2.8", | ||
"@gedit/utils": "^0.2.8" | ||
}, | ||
@@ -31,3 +31,3 @@ "geditExtensions": [ | ||
}, | ||
"gitHead": "5fd2e0b75c7fa4c5972e56d59dd00d7fce84f11a" | ||
"gitHead": "0d2ac4eadcab052623caaedf2b658065129b2129" | ||
} |
@@ -14,3 +14,3 @@ /* eslint-disable max-len, @typescript-eslint/indent */ | ||
const dropdownBackgroundColor = '#100A22'; | ||
const dropdownBackgroundColor = '#191B1E'; | ||
@@ -665,7 +665,7 @@ const lightColor = '#ffffff'; | ||
}, | ||
{ | ||
/* { | ||
id: 'menu.border', | ||
defaults: {}, | ||
description: 'Border color of menus.', | ||
}, | ||
}, */ | ||
{ | ||
@@ -707,3 +707,3 @@ id: 'menu.foreground', | ||
defaults: { | ||
dark: '#BBBBBB', | ||
dark: 'menu.border', | ||
}, | ||
@@ -710,0 +710,0 @@ description: 'Color of a separator menu item in menus.', |
@@ -22,2 +22,3 @@ /******************************************************************************** | ||
// import '../../src/browser/style/variables-bright.useable.css'; | ||
import '../../src/browser/style/variables-operation.css'; | ||
@@ -45,2 +46,4 @@ export const ThemeServiceSymbol = Symbol('ThemeService'); | ||
export type ThemeMode = 'develop' | 'operation'; | ||
export class ThemeService { | ||
@@ -52,2 +55,4 @@ | ||
mode: ThemeMode = 'operation'; | ||
readonly onThemeChange: Event<ThemeChangeEvent> = this.themeChange.event; | ||
@@ -61,4 +66,12 @@ | ||
global[ThemeServiceSymbol] = this; | ||
this.mode = this.getThemeMode(); | ||
this.initModeClassName(); | ||
} | ||
initModeClassName(): void { | ||
const documentElement = document.documentElement; | ||
documentElement.className = `${documentElement.className || ''}${ | ||
this.mode === 'operation' ? ' gedit-operation' : ''}`.trim(); | ||
} | ||
/** | ||
@@ -103,2 +116,13 @@ * The default theme. If that is not applicable, returns with the fallback theme. | ||
getThemeMode(): ThemeMode { | ||
const mode = window.localStorage.getItem('theme:mode') || 'operation'; | ||
return mode as ThemeMode; | ||
} | ||
setThemeMode(mode: ThemeMode): void { | ||
const m = mode || 'operation'; | ||
window.localStorage.setItem('theme:mode', m); | ||
this.mode = m; | ||
} | ||
startupTheme(): void { | ||
@@ -105,0 +129,0 @@ const theme = this.getCurrentTheme(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
368777
116
5092
Updated@gedit/utils@^0.2.8