]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Add CSS variables to all elements
authorJeremy Thomas <bbxdesign@gmail.com>
Sat, 15 Aug 2020 23:52:25 +0000 (00:52 +0100)
committerJeremy Thomas <bbxdesign@gmail.com>
Sat, 15 Aug 2020 23:52:25 +0000 (00:52 +0100)
sass/elements/box.sass
sass/elements/content.sass
sass/elements/tag.sass
sass/elements/title.sass

index 4fd593bafc3d50eb4b20d3936569a903e8eff1c4..b424ff47a304758eeaca85d0e0e512a1732d90a9 100644 (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-link-hover-shadow: #{$box-link-hover-shadow}
   --box-link-active-shadow: #{$box-link-active-shadow}
+
   @extend %block
   background-color: var(--box-background-color)
   border-radius: var(--box-radius)
index bbc9b230176216783bb5a57b8dfe0057ccd648d6..f64ce271eef14e8767c27cdb2acf082283ba846e 100644 (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-foot-cell-border-width: #{$content-table-foot-cell-border-width}
   --content-table-foot-cell-color: #{$content-table-foot-cell-color}
+
   @extend %block
   font-size: var(--content-font-size)
   // Inline
index 16e964f0c922ed20a2dd9d99eb933bd8ff558888..be2a21b44fd0fe82e454a3b5f296a39da0a447ee 100644 (file)
@@ -1,6 +1,6 @@
-$tag-background-color: $background !default
-$tag-color: $text !default
-$tag-radius: $radius !default
+$tag-background-color: var(--background, #{$background}) !default
+$tag-color: var(--text, #{$text}) !default
+$tag-radius: var(--radius, #{$radius}) !default
 $tag-delete-margin: 1px !default
 
 .tags
@@ -19,10 +19,10 @@ $tag-delete-margin: 1px !default
   // Sizes
   &.are-medium
     .tag:not(.is-normal):not(.is-large)
-      font-size: $size-normal
+      --tag-font-size: var(--size-normal, #{$size-normal})
   &.are-large
     .tag:not(.is-normal):not(.is-medium)
-      font-size: $size-medium
+      --tag-font-size: var(--size-medium, #{$size-medium})
   &.is-centered
     justify-content: center
     .tag
@@ -55,12 +55,17 @@ $tag-delete-margin: 1px !default
           border-bottom-left-radius: 0
 
 .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
-  background-color: $tag-background-color
-  border-radius: $tag-radius
-  color: $tag-color
+  background-color: var(--tag-background-color)
+  border-radius: var(--tag-radius)
+  color: var(--tag-color)
   display: inline-flex
-  font-size: $size-small
+  font-size: var(--tag-font-size)
   height: 2em
   justify-content: center
   line-height: 1.5
@@ -75,22 +80,22 @@ $tag-delete-margin: 1px !default
     $color: nth($pair, 1)
     $color-invert: nth($pair, 2)
     &.is-#{$name}
-      background-color: $color
-      color: $color-invert
+      --tag-background-color: var(--#{$name}, #{$color})
+      --tag-color: var(--#{$name}-invert, #{$color-invert})
       // If a light and dark colors are provided
       @if length($pair) > 3
         $color-light: nth($pair, 3)
         $color-dark: nth($pair, 4)
         &.is-light
-          background-color: $color-light
-          color: $color-dark
+          --tag-background-color: var(--#{$name}-light, #{$color-light})
+          --tag-color: var(--#{$name}-dark, #{$color-dark})
   // Sizes
-  &.is-normal
-    font-size: $size-small
+  &.is-small
+    --tag-font-size: var(--size-small, #{$size-small})
   &.is-medium
-    font-size: $size-normal
+    --tag-font-size: var(--size-medium, #{$size-medium})
   &.is-large
-    font-size: $size-medium
+    --tag-font-size: var(--size-large, #{$size-large})
   .icon
     &:first-child:not(:last-child)
       +ltr-property("margin", -0.375em, false)
@@ -103,7 +108,7 @@ $tag-delete-margin: 1px !default
       +ltr-property("margin", -0.375em)
   // Modifiers
   &.is-delete
-    +ltr-property("margin", $tag-delete-margin, false)
+    +ltr-property("margin", var(--tag-delete-margin), false)
     padding: 0
     position: relative
     width: 2em
@@ -129,7 +134,7 @@ $tag-delete-margin: 1px !default
     &:active
       background-color: bulmaDarken($tag-background-color, 10%)
   &.is-rounded
-    border-radius: $radius-rounded
+    border-radius: var(--radius-rounded, #{$radius-rounded})
 
 a.tag
   &:hover
index eb858868e77a0b3ff082e0766066b6e3cb2e61fa..418c5737d8e0927b583c68da5e37b736fb2ba548 100644 (file)
@@ -51,12 +51,13 @@ $subtitle-negative-margin: -1.25rem !default
   --title-color: #{$title-color}
   color: var(--title-color)
 
-  --title-size: #{$title-size}
+  --title-font-size: #{$title-size}
   --title-weight: #{$title-weight}
   --title-line-height: #{$title-line-height}
   --title-strong-color: #{$title-strong-color}
   --title-strong-weight: #{$title-strong-weight}
-  font-size: var(--title-size)
+
+  font-size: var(--title-font-size)
   font-weight: var(--title-weight)
   line-height: var(--title-line-height)
   @if $title-family
@@ -78,13 +79,14 @@ $subtitle-negative-margin: -1.25rem !default
 .subtitle
   --subtitle-negative-margin: #{$subtitle-negative-margin}
   --subtitle-color: #{$subtitle-color}
-  --subtitle-size: #{$subtitle-size}
+  --subtitle-font-size: #{$subtitle-size}
   --subtitle-weight: #{$subtitle-weight}
   --subtitle-line-height: #{$subtitle-line-height}
   --subtitle-strong-color: #{$subtitle-strong-color}
   --subtitle-strong-weight: #{$subtitle-strong-weight}
+
   color: var(--subtitle-color)
-  font-size: var(--subtitle-size)
+  font-size: var(--subtitle-font-size)
   font-weight: var(--subtitle-weight)
   line-height: var(--subtitle-line-height)
   @if $subtitle-family
@@ -99,4 +101,4 @@ $subtitle-negative-margin: -1.25rem !default
   @each $size in $sizes
     $i: index($sizes, $size)
     &.is-#{$i}
-      font-size: $size
+      --subtitle-font-size: $size