Add CSS variables to all elements

This commit is contained in:
Jeremy Thomas 2020-08-16 00:52:25 +01:00
parent 340f13d168
commit 0ecc5bd35d
4 changed files with 33 additions and 24 deletions

View File

@ -21,6 +21,7 @@ $box-link-active-shadow: inset 0 1px 2px $box-link-active-shadow-color, 0 0 0 1p
--box-padding: #{$box-padding} --box-padding: #{$box-padding}
--box-link-hover-shadow: #{$box-link-hover-shadow} --box-link-hover-shadow: #{$box-link-hover-shadow}
--box-link-active-shadow: #{$box-link-active-shadow} --box-link-active-shadow: #{$box-link-active-shadow}
@extend %block @extend %block
background-color: var(--box-background-color) background-color: var(--box-background-color)
border-radius: var(--box-radius) border-radius: var(--box-radius)

View File

@ -36,6 +36,7 @@ $content-table-foot-cell-color: var(--text-strong, #{$text-strong}) !default
--content-table-head-cell-color: #{$content-table-head-cell-color} --content-table-head-cell-color: #{$content-table-head-cell-color}
--content-table-foot-cell-border-width: #{$content-table-foot-cell-border-width} --content-table-foot-cell-border-width: #{$content-table-foot-cell-border-width}
--content-table-foot-cell-color: #{$content-table-foot-cell-color} --content-table-foot-cell-color: #{$content-table-foot-cell-color}
@extend %block @extend %block
font-size: var(--content-font-size) font-size: var(--content-font-size)
// Inline // Inline

View File

@ -1,6 +1,6 @@
$tag-background-color: $background !default $tag-background-color: var(--background, #{$background}) !default
$tag-color: $text !default $tag-color: var(--text, #{$text}) !default
$tag-radius: $radius !default $tag-radius: var(--radius, #{$radius}) !default
$tag-delete-margin: 1px !default $tag-delete-margin: 1px !default
.tags .tags
@ -19,10 +19,10 @@ $tag-delete-margin: 1px !default
// Sizes // Sizes
&.are-medium &.are-medium
.tag:not(.is-normal):not(.is-large) .tag:not(.is-normal):not(.is-large)
font-size: $size-normal --tag-font-size: var(--size-normal, #{$size-normal})
&.are-large &.are-large
.tag:not(.is-normal):not(.is-medium) .tag:not(.is-normal):not(.is-medium)
font-size: $size-medium --tag-font-size: var(--size-medium, #{$size-medium})
&.is-centered &.is-centered
justify-content: center justify-content: center
.tag .tag
@ -55,12 +55,17 @@ $tag-delete-margin: 1px !default
border-bottom-left-radius: 0 border-bottom-left-radius: 0
.tag:not(body) .tag:not(body)
--tag-background-color: #{$tag-background-color}
--tag-radius: #{$tag-radius}
--tag-color: #{$tag-color}
--tag-font-size: #{$size-small}
--tag-delete-margin: #{$tag-delete-margin}
align-items: center align-items: center
background-color: $tag-background-color background-color: var(--tag-background-color)
border-radius: $tag-radius border-radius: var(--tag-radius)
color: $tag-color color: var(--tag-color)
display: inline-flex display: inline-flex
font-size: $size-small font-size: var(--tag-font-size)
height: 2em height: 2em
justify-content: center justify-content: center
line-height: 1.5 line-height: 1.5
@ -75,22 +80,22 @@ $tag-delete-margin: 1px !default
$color: nth($pair, 1) $color: nth($pair, 1)
$color-invert: nth($pair, 2) $color-invert: nth($pair, 2)
&.is-#{$name} &.is-#{$name}
background-color: $color --tag-background-color: var(--#{$name}, #{$color})
color: $color-invert --tag-color: var(--#{$name}-invert, #{$color-invert})
// If a light and dark colors are provided // If a light and dark colors are provided
@if length($pair) > 3 @if length($pair) > 3
$color-light: nth($pair, 3) $color-light: nth($pair, 3)
$color-dark: nth($pair, 4) $color-dark: nth($pair, 4)
&.is-light &.is-light
background-color: $color-light --tag-background-color: var(--#{$name}-light, #{$color-light})
color: $color-dark --tag-color: var(--#{$name}-dark, #{$color-dark})
// Sizes // Sizes
&.is-normal &.is-small
font-size: $size-small --tag-font-size: var(--size-small, #{$size-small})
&.is-medium &.is-medium
font-size: $size-normal --tag-font-size: var(--size-medium, #{$size-medium})
&.is-large &.is-large
font-size: $size-medium --tag-font-size: var(--size-large, #{$size-large})
.icon .icon
&:first-child:not(:last-child) &:first-child:not(:last-child)
+ltr-property("margin", -0.375em, false) +ltr-property("margin", -0.375em, false)
@ -103,7 +108,7 @@ $tag-delete-margin: 1px !default
+ltr-property("margin", -0.375em) +ltr-property("margin", -0.375em)
// Modifiers // Modifiers
&.is-delete &.is-delete
+ltr-property("margin", $tag-delete-margin, false) +ltr-property("margin", var(--tag-delete-margin), false)
padding: 0 padding: 0
position: relative position: relative
width: 2em width: 2em
@ -129,7 +134,7 @@ $tag-delete-margin: 1px !default
&:active &:active
background-color: bulmaDarken($tag-background-color, 10%) background-color: bulmaDarken($tag-background-color, 10%)
&.is-rounded &.is-rounded
border-radius: $radius-rounded border-radius: var(--radius-rounded, #{$radius-rounded})
a.tag a.tag
&:hover &:hover

View File

@ -51,12 +51,13 @@ $subtitle-negative-margin: -1.25rem !default
--title-color: #{$title-color} --title-color: #{$title-color}
color: var(--title-color) color: var(--title-color)
--title-size: #{$title-size} --title-font-size: #{$title-size}
--title-weight: #{$title-weight} --title-weight: #{$title-weight}
--title-line-height: #{$title-line-height} --title-line-height: #{$title-line-height}
--title-strong-color: #{$title-strong-color} --title-strong-color: #{$title-strong-color}
--title-strong-weight: #{$title-strong-weight} --title-strong-weight: #{$title-strong-weight}
font-size: var(--title-size)
font-size: var(--title-font-size)
font-weight: var(--title-weight) font-weight: var(--title-weight)
line-height: var(--title-line-height) line-height: var(--title-line-height)
@if $title-family @if $title-family
@ -78,13 +79,14 @@ $subtitle-negative-margin: -1.25rem !default
.subtitle .subtitle
--subtitle-negative-margin: #{$subtitle-negative-margin} --subtitle-negative-margin: #{$subtitle-negative-margin}
--subtitle-color: #{$subtitle-color} --subtitle-color: #{$subtitle-color}
--subtitle-size: #{$subtitle-size} --subtitle-font-size: #{$subtitle-size}
--subtitle-weight: #{$subtitle-weight} --subtitle-weight: #{$subtitle-weight}
--subtitle-line-height: #{$subtitle-line-height} --subtitle-line-height: #{$subtitle-line-height}
--subtitle-strong-color: #{$subtitle-strong-color} --subtitle-strong-color: #{$subtitle-strong-color}
--subtitle-strong-weight: #{$subtitle-strong-weight} --subtitle-strong-weight: #{$subtitle-strong-weight}
color: var(--subtitle-color) color: var(--subtitle-color)
font-size: var(--subtitle-size) font-size: var(--subtitle-font-size)
font-weight: var(--subtitle-weight) font-weight: var(--subtitle-weight)
line-height: var(--subtitle-line-height) line-height: var(--subtitle-line-height)
@if $subtitle-family @if $subtitle-family
@ -99,4 +101,4 @@ $subtitle-negative-margin: -1.25rem !default
@each $size in $sizes @each $size in $sizes
$i: index($sizes, $size) $i: index($sizes, $size)
&.is-#{$i} &.is-#{$i}
font-size: $size --subtitle-font-size: $size