-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commited first draft to theming in kopia.
- Changed variants of buttons to unify the look and feel - Added support for themes specified in Theme.css - Added a new dependency "react-select" for selecting themes.
- Loading branch information
Showing
13 changed files
with
577 additions
and
131 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,64 @@ | ||
/*Supported themes */ | ||
.light-theme { | ||
--background-color: #ffffff; | ||
--color-primary: #2A7FFF; | ||
--color-secondary: #23a25a; | ||
--color-warning: #e1704b; | ||
--color-success: #5ea5cd; | ||
--color-submit: #00B4D8; | ||
|
||
--text-color: #ffffff; | ||
--text-color-body: #000000; | ||
--text-color-nav: #000000; | ||
|
||
--color-error: #d2475a; | ||
--color-danger: #d2475a; | ||
} | ||
|
||
.dark-theme { | ||
--background-color: #000000; | ||
--color-primary: #1162b1; | ||
--color-secondary: #0d9aab; | ||
--color-warning: #b30996; | ||
--color-success: #030303; | ||
--color-submit: #00B4D8; | ||
|
||
--text-color: #ffffff; | ||
--text-color-body: #ffffff; | ||
--text-color-nav: #ffffff; | ||
|
||
--color-error: #b31f04; | ||
--color-danger: #b31f04; | ||
} | ||
|
||
.pastel-theme { | ||
--background-color: #ffffff; | ||
--color-primary: #9feae7; | ||
--color-secondary: #d7a5e9; | ||
--color-warning: #ffe070; | ||
--color-success: #d7a5e9; | ||
--color-submit: #00B4D8; | ||
|
||
--text-color: #000000; | ||
--text-color-body: #000000; | ||
--text-color-nav: #d7a5e9; | ||
|
||
--color-error: #b31f04; | ||
--color-danger: #b31f04; | ||
} | ||
|
||
.ocean-theme { | ||
--background-color: #ffffff; | ||
--color-primary: #03045E; | ||
--color-secondary: #0077B6; | ||
--color-warning: #00B4D8; | ||
--color-success: #48CAE4; | ||
--color-submit: #00B4D8; | ||
|
||
--text-color: #ffffff; | ||
--text-color-body: #03045E; | ||
--text-color-nav: #03045E; | ||
|
||
--color-error: #d2475a; | ||
--color-danger: #d2475a; | ||
} |
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,30 @@ | ||
import Select from 'react-select' | ||
import { useContext } from 'react'; | ||
import { Theme, UIPreferencesContext } from './contexts/UIPreferencesContext'; | ||
|
||
export function ThemeSelector() { | ||
const { theme, setTheme } = useContext(UIPreferencesContext); | ||
|
||
updateTheme(theme) | ||
|
||
const themes = [ | ||
{ value: 'light-theme', label: 'light' }, | ||
{ value: 'dark-theme', label: 'dark' }, | ||
{ value: 'pastel-theme', label: 'pastel' }, | ||
{ value: 'ocean-theme', label: 'ocean' } | ||
] | ||
|
||
const handleTheme = (event: any) => { | ||
var selectedTheme = event.value; | ||
// keep html class in sync with button state. | ||
updateTheme(selectedTheme) | ||
setTheme(selectedTheme) | ||
}; | ||
|
||
return <Select defaultValue={themes[0]} options={themes} onChange={handleTheme} /> | ||
} | ||
|
||
function updateTheme(theme: Theme) { | ||
var doc = document.querySelector("html")!; | ||
doc.className = theme | ||
} |
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
Oops, something went wrong.