Skip to content

Commit

Permalink
use a function to create rgba colors
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau committed May 10, 2022
1 parent 3fd40b9 commit be98a87
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/pydata_sphinx_theme/assets/styles/abstracts/_functions.scss
@@ -0,0 +1,13 @@
/*********************************************
* SASS Functions
*********************************************/

/********************************************
* generate rgba colors from the rgb defined variables
*/
@function colorAlpha($color, $opacity) {
$red: red($color);
$green: green($color);
$blue: blue($color);
@return rgba($red, $green, $blue, $opacity);
}
5 changes: 3 additions & 2 deletions src/pydata_sphinx_theme/assets/styles/content/_spans.scss
Expand Up @@ -4,6 +4,7 @@

span.guilabel {
border: 1px solid var(--pst-color-info);
background-color: colorAlpha(var(--pst-color-info), 0.1);
color: var(--pst-color-info);
font-size: 80%;
font-weight: 700;
Expand All @@ -14,7 +15,7 @@ span.guilabel {

// This is a hack to control the opacity for admonitions with our color variables
// ref: https://stackoverflow.com/a/56951626/6734243
&:before {
/*&:before {
content: "";
width: 100%;
height: 100%;
Expand All @@ -23,5 +24,5 @@ span.guilabel {
top: 0;
background-color: var(--pst-color-info);
opacity: 0.1;
}
}*/
}
3 changes: 3 additions & 0 deletions src/pydata_sphinx_theme/assets/styles/index.scss
Expand Up @@ -18,6 +18,9 @@ $grid-breakpoints: (
);
@import "~bootstrap/scss/bootstrap";

// Variables and re-usable SCSS functions
@import "abstracts/functions";

// Basic styling applied throughout site
@import "./base/base";
@import "./base/color";
Expand Down

0 comments on commit be98a87

Please sign in to comment.