Skip to content
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

Theme Global Base Styles #60

Merged
merged 2 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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