-
Notifications
You must be signed in to change notification settings - Fork 357
feat: add support for system color scheme #3167
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
Merged
ravern
merged 21 commits into
nusmodifications:master
from
chrisgzf:os-default-night-dark-mode
May 22, 2024
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
54f9a7a
Add typings for default display mode
chrisgzf 7ba7ee8
Add default mode to dark mode UI selector
chrisgzf 8879634
Add CSS util to detect OS display mode
chrisgzf 5434ade
Add OS display mode detection for AppShell
chrisgzf 5a98f32
Update defaults and update reducers
chrisgzf 83b0d35
Delay evaluation of matchMedia
chrisgzf 72a25cb
Add comments
chrisgzf 9e31352
OS Default -> Auto-detect
chrisgzf 7aac77c
feat: undo media query in reducer
ravern ca24f77
feat: add color scheme selection, remove toggle
ravern fc25b66
refactor: ExportMenu into functional component
ravern d824b9b
fix: add colorscheme to export preferences
ravern 005acad
fix: tests
ravern f07172f
fix: type error in reducer
ravern 2f300c8
chore: fix typecheck
ravern 07d38e3
chore: remove obsolete snapshot
ravern d8f172c
fix: toggling
ravern 736bf22
Merge branch 'master' into os-default-night-dark-mode
ravern 6aef1a6
Merge branch 'master' into os-default-night-dark-mode
kokrui 2b9c53d
Merge branch 'master' into os-default-night-dark-mode
ravern 55da21f
Merge branch 'master' into os-default-night-dark-mode
ravern File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 +1,29 @@ | ||
| export type ThemeId = string; | ||
|
|
||
| /** | ||
| * Themes are the "color palette" of the website. They define the set of colors | ||
| * being used across the website. | ||
| */ | ||
| export type Theme = { | ||
| readonly id: ThemeId; | ||
| readonly name: string; | ||
| }; | ||
|
|
||
| export type Mode = 'LIGHT' | 'DARK'; | ||
| export const LIGHT_MODE: Mode = 'LIGHT'; | ||
| export const DARK_MODE: Mode = 'DARK'; | ||
| /** | ||
| * Color schemes simply define whether the website is in light or dark mode. This | ||
| * is not to be confused with themese, which define the color palette of the website. | ||
|
Member
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. nit: themese -> themes |
||
| */ | ||
| export type ColorScheme = 'LIGHT_COLOR_SCHEME' | 'DARK_COLOR_SCHEME'; | ||
|
|
||
| export const LIGHT_COLOR_SCHEME: ColorScheme = 'LIGHT_COLOR_SCHEME'; | ||
| export const DARK_COLOR_SCHEME: ColorScheme = 'DARK_COLOR_SCHEME'; | ||
|
|
||
| export type ColorSchemePreference = | ||
| | 'SYSTEM_COLOR_SCHEME_PREFERENCE' | ||
| | 'LIGHT_COLOR_SCHEME_PREFERENCE' | ||
| | 'DARK_COLOR_SCHEME_PREFERENCE'; | ||
|
|
||
| export const SYSTEM_COLOR_SCHEME_PREFERENCE: ColorSchemePreference = | ||
| 'SYSTEM_COLOR_SCHEME_PREFERENCE'; | ||
| export const LIGHT_COLOR_SCHEME_PREFERENCE: ColorSchemePreference = 'LIGHT_COLOR_SCHEME_PREFERENCE'; | ||
| export const DARK_COLOR_SCHEME_PREFERENCE: ColorSchemePreference = 'DARK_COLOR_SCHEME_PREFERENCE'; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
wow this is a much-needed refactoring LOL good stuff