-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ENV variable allowing to choose default color schema (#1882)
* Add ENV variable allowing to choose default color schema Fixes #1868 * Update values.yaml.gotmpl --------- Co-authored-by: Yan Vaskov <72267126+yvaskov@users.noreply.github.com>
- Loading branch information
Showing
16 changed files
with
90 additions
and
36 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
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
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,42 @@ | ||
import type { ColorMode } from '@chakra-ui/react'; | ||
|
||
import type { ColorThemeId } from 'types/settings'; | ||
|
||
interface ColorTheme { | ||
id: ColorThemeId; | ||
label: string; | ||
colorMode: ColorMode; | ||
hex: string; | ||
sampleBg: string; | ||
} | ||
|
||
export const COLOR_THEMES: Array<ColorTheme> = [ | ||
{ | ||
id: 'light', | ||
label: 'Light', | ||
colorMode: 'light', | ||
hex: '#FFFFFF', | ||
sampleBg: 'linear-gradient(154deg, #EFEFEF 50%, rgba(255, 255, 255, 0.00) 330.86%)', | ||
}, | ||
{ | ||
id: 'dim', | ||
label: 'Dim', | ||
colorMode: 'dark', | ||
hex: '#232B37', | ||
sampleBg: 'linear-gradient(152deg, #232B37 50%, rgba(255, 255, 255, 0.00) 290.71%)', | ||
}, | ||
{ | ||
id: 'midnight', | ||
label: 'Midnight', | ||
colorMode: 'dark', | ||
hex: '#1B2E48', | ||
sampleBg: 'linear-gradient(148deg, #1B3F71 50%, rgba(255, 255, 255, 0.00) 312.35%)', | ||
}, | ||
{ | ||
id: 'dark', | ||
label: 'Dark', | ||
colorMode: 'dark', | ||
hex: '#101112', | ||
sampleBg: 'linear-gradient(161deg, #000 9.37%, #383838 92.52%)', | ||
}, | ||
]; |
29 changes: 0 additions & 29 deletions
29
ui/snippets/topBar/settings/utils.ts → lib/settings/identIcon.ts
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,15 @@ | ||
import type { NextRequest, NextResponse } from 'next/server'; | ||
|
||
import appConfig from 'configs/app'; | ||
import * as cookiesLib from 'lib/cookies'; | ||
|
||
export default function colorThemeMiddleware(req: NextRequest, res: NextResponse) { | ||
const colorModeCookie = req.cookies.get(cookiesLib.NAMES.COLOR_MODE); | ||
|
||
if (!colorModeCookie) { | ||
if (appConfig.UI.colorTheme.default) { | ||
res.cookies.set(cookiesLib.NAMES.COLOR_MODE, appConfig.UI.colorTheme.default.colorMode, { path: '/' }); | ||
res.cookies.set(cookiesLib.NAMES.COLOR_MODE_HEX, appConfig.UI.colorTheme.default.hex, { path: '/' }); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export { account } from './account'; | ||
export { default as colorTheme } from './colorTheme'; |
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,2 @@ | ||
export const COLOR_THEME_IDS = [ 'light', 'dim', 'midnight', 'dark' ] as const; | ||
export type ColorThemeId = typeof COLOR_THEME_IDS[number]; |
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