Skip to content

Commit

Permalink
feat(styles): set background color on body (#11255)
Browse files Browse the repository at this point in the history
* feat(styles): set background color on body

* feat(styles): add support for css--body in config

* chore(test): update snapshots

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
joshblack and kodiakhq[bot] committed Apr 28, 2022
1 parent 73d5c3e commit 3b7b2c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`@carbon/styles/scss/config Public API 1`] = `
Object {
"css--body": true,
"css--default-type": true,
"css--font-face": true,
"css--reset": true,
Expand Down
7 changes: 7 additions & 0 deletions packages/styles/scss/_config.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
// LICENSE file in the root directory of this source tree.
//

/// Specify whether default styles should be emitted for the <body> element,
/// specifically background and text color
/// @access public
/// @type Bool
/// @group config
$css--body: true !default;

/// If true, includes font face mixins from scss/fonts
/// @access public
/// @type Bool
Expand Down
6 changes: 6 additions & 0 deletions packages/styles/scss/_reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

@use 'config';
@use 'type' as type;
@use './utilities/custom-property';

@mixin reset {
/// http://meyerweb.com/eric/tools/css/reset/
Expand Down Expand Up @@ -118,6 +119,11 @@
}

body {
@if config.$css--body == true {
background-color: custom-property.get-var('background', #ffffff);
color: custom-property.get-var('text-primary', #161616);
}

line-height: 1;
}

Expand Down

0 comments on commit 3b7b2c0

Please sign in to comment.