Skip to content

Commit

Permalink
Integrate basic font and background colors in global CSS theme styles
Browse files Browse the repository at this point in the history
This includes a `transition` for both attributes to ensure a smooth
theme mode transition.

Associated epic: GH-51
GH-59
  • Loading branch information
arcticicestudio committed Dec 4, 2018
1 parent dc5f56b commit 68a39cc
Showing 1 changed file with 18 additions and 0 deletions.
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 68a39cc

Please sign in to comment.