Skip to content

Commit 2c545da

Browse files
Merge pull request #60 from arcticicestudio/feature/gh-59-theme-global-base-styles
Theme Global Base Styles
2 parents 86edb92 + 68a39cc commit 2c545da

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

src/styles/theme/colors/background.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
3+
* Copyright (C) 2018-present Sven Greb <[email protected]>
4+
*
5+
* Project: Nord Docs
6+
* Repository: https://github.com/arcticicestudio/nord-docs
7+
* License: MIT
8+
*/
9+
10+
/**
11+
* @file Provides theme background colors.
12+
* @author Arctic Ice Studio <[email protected]>
13+
* @author Sven Greb <[email protected]>
14+
* @since 0.2.0
15+
*/
16+
17+
import nord from "./nord";
18+
import { MODE_BRIGHT_SNOW_FLURRY, MODE_DARK_NIGHT_FROST } from "../constants";
19+
20+
const base = {
21+
[MODE_BRIGHT_SNOW_FLURRY]: "#fff",
22+
[MODE_DARK_NIGHT_FROST]: nord.nord0
23+
};
24+
25+
const background = { base };
26+
27+
export default background;

src/styles/theme/colors/font.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
3+
* Copyright (C) 2018-present Sven Greb <[email protected]>
4+
*
5+
* Project: Nord Docs
6+
* Repository: https://github.com/arcticicestudio/nord-docs
7+
* License: MIT
8+
*/
9+
10+
/**
11+
* @file Provides theme font colors.
12+
* @author Arctic Ice Studio <[email protected]>
13+
* @author Sven Greb <[email protected]>
14+
* @since 0.2.0
15+
*/
16+
17+
import nord from "./nord";
18+
import { MODE_BRIGHT_SNOW_FLURRY, MODE_DARK_NIGHT_FROST } from "../constants";
19+
20+
const base = {
21+
[MODE_BRIGHT_SNOW_FLURRY]: nord.nord3,
22+
[MODE_DARK_NIGHT_FROST]: nord.nord6
23+
};
24+
25+
const font = { base };
26+
27+
export default font;

src/styles/theme/colors/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
* @since 0.2.0
1515
*/
1616

17+
import background from "./background";
18+
import font from "./font";
1719
import nord from "./nord";
1820
import palettes from "./palettes";
1921

2022
const colors = {
23+
background,
24+
font,
2125
...nord,
2226
...palettes
2327
};

src/styles/theme/globals.js

+18
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,21 @@
1616

1717
import { css } from "styled-components";
1818

19+
import colors from "./colors";
20+
import { speed } from "./motion";
1921
import typography from "./typography";
22+
import { themedMode } from "./utils";
23+
import { MODE_BRIGHT_SNOW_FLURRY, MODE_DARK_NIGHT_FROST } from "./constants";
24+
25+
const baseBackgroundColor = themedMode({
26+
[MODE_BRIGHT_SNOW_FLURRY]: colors.background.base[MODE_BRIGHT_SNOW_FLURRY],
27+
[MODE_DARK_NIGHT_FROST]: colors.background.base[MODE_DARK_NIGHT_FROST]
28+
});
29+
30+
const baseFontColor = themedMode({
31+
[MODE_BRIGHT_SNOW_FLURRY]: colors.font.base[MODE_BRIGHT_SNOW_FLURRY],
32+
[MODE_DARK_NIGHT_FROST]: colors.font.base[MODE_DARK_NIGHT_FROST]
33+
});
2034

2135
const globals = css`
2236
html {
@@ -28,6 +42,10 @@ const globals = css`
2842
font-size: ${typography.sizes.msBase}rem;
2943
font-weight: ${typography.sizes.weight};
3044
line-height: ${typography.sizes.lineHeight};
45+
color: ${baseFontColor};
46+
background-color: ${baseBackgroundColor};
47+
transition: color ${speed.duration.transition.base.themeModeSwitch}s ease-in-out,
48+
background-color ${speed.duration.transition.base.themeModeSwitch}s ease-in-out;
3149
scroll-behavior: smooth;
3250
}
3351
`;

0 commit comments

Comments
 (0)