Skip to content

Commit

Permalink
Merge pull request #60 from arcticicestudio/feature/gh-59-theme-globa…
Browse files Browse the repository at this point in the history
…l-base-styles

Theme Global Base Styles
  • Loading branch information
arcticicestudio authored Dec 4, 2018
2 parents 86edb92 + 68a39cc commit 2c545da
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/styles/theme/colors/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file Provides theme background colors.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @since 0.2.0
*/

import nord from "./nord";
import { MODE_BRIGHT_SNOW_FLURRY, MODE_DARK_NIGHT_FROST } from "../constants";

const base = {
[MODE_BRIGHT_SNOW_FLURRY]: "#fff",
[MODE_DARK_NIGHT_FROST]: nord.nord0
};

const background = { base };

export default background;
27 changes: 27 additions & 0 deletions src/styles/theme/colors/font.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file Provides theme font colors.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @since 0.2.0
*/

import nord from "./nord";
import { MODE_BRIGHT_SNOW_FLURRY, MODE_DARK_NIGHT_FROST } from "../constants";

const base = {
[MODE_BRIGHT_SNOW_FLURRY]: nord.nord3,
[MODE_DARK_NIGHT_FROST]: nord.nord6
};

const font = { base };

export default font;
4 changes: 4 additions & 0 deletions src/styles/theme/colors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
* @since 0.2.0
*/

import background from "./background";
import font from "./font";
import nord from "./nord";
import palettes from "./palettes";

const colors = {
background,
font,
...nord,
...palettes
};
Expand Down
18 changes: 18 additions & 0 deletions src/styles/theme/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,21 @@

import { css } from "styled-components";

import colors from "./colors";
import { speed } from "./motion";
import typography from "./typography";
import { themedMode } from "./utils";
import { MODE_BRIGHT_SNOW_FLURRY, MODE_DARK_NIGHT_FROST } from "./constants";

const baseBackgroundColor = themedMode({
[MODE_BRIGHT_SNOW_FLURRY]: colors.background.base[MODE_BRIGHT_SNOW_FLURRY],
[MODE_DARK_NIGHT_FROST]: colors.background.base[MODE_DARK_NIGHT_FROST]
});

const baseFontColor = themedMode({
[MODE_BRIGHT_SNOW_FLURRY]: colors.font.base[MODE_BRIGHT_SNOW_FLURRY],
[MODE_DARK_NIGHT_FROST]: colors.font.base[MODE_DARK_NIGHT_FROST]
});

const globals = css`
html {
Expand All @@ -28,6 +42,10 @@ const globals = css`
font-size: ${typography.sizes.msBase}rem;
font-weight: ${typography.sizes.weight};
line-height: ${typography.sizes.lineHeight};
color: ${baseFontColor};
background-color: ${baseBackgroundColor};
transition: color ${speed.duration.transition.base.themeModeSwitch}s ease-in-out,
background-color ${speed.duration.transition.base.themeModeSwitch}s ease-in-out;
scroll-behavior: smooth;
}
`;
Expand Down

0 comments on commit 2c545da

Please sign in to comment.