| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
// Selected set of PF chart colors to optimize for full-spectrum and colorblindness |
| 3 |
// using unique part of PF name and a hex color fallback |
| 4 |
$plotColors: ( |
| 5 |
"blue--300" #06c, |
| 6 |
"green--100" #bde2b9, |
| 7 |
"teal--200" #73c5c5, |
| 8 |
"purple--100" #b2b0ea, |
| 9 |
"gold--300" #f4c145, |
| 10 |
"orange--300" #ec7a08, |
| 11 |
"red-orange--200" #a30000, |
| 12 |
"teal--300" #009596, |
| 13 |
"black--500" #4d5258 |
| 14 |
); |
| 15 |
|
| 16 |
.ct-plot { |
| 17 |
font-family: var(--pf-t--global--font--family--body); |
| 18 |
|
| 19 |
&-border { |
| 20 |
stroke: var(--pf-t--chart--global--fill--color--300); |
| 21 |
fill: transparent; |
| 22 |
shape-rendering: crispedges; |
| 23 |
} |
| 24 |
|
| 25 |
&-title { |
| 26 |
font-size: calc(var(--pf-t--chart--global--FontSize--sm) * 1px); |
| 27 |
} |
| 28 |
|
| 29 |
// Placeholder string to stretch the column, set offscreen |
| 30 |
&-widest { |
| 31 |
fill: transparent; |
| 32 |
} |
| 33 |
|
| 34 |
&-axis, |
| 35 |
&-unit { |
| 36 |
font-size: calc(var(--pf-t--chart--global--FontSize--xs) * 1px); |
| 37 |
fill: var(--pf-t--chart--global--fill--color--700); |
| 38 |
letter-spacing: var(--pf-t--chart--global--letter-spacing); |
| 39 |
} |
| 40 |
|
| 41 |
.pf-v6-theme-dark &-axis, |
| 42 |
.pf-v6-theme-dark &-unit { |
| 43 |
fill: var(--pf-t--chart--global--fill--color--400); |
| 44 |
} |
| 45 |
|
| 46 |
&-lines, |
| 47 |
&-ticks { |
| 48 |
stroke: var(--pf-t--chart--global--fill--color--300); |
| 49 |
shape-rendering: crispedges; |
| 50 |
} |
| 51 |
|
| 52 |
&-selection { |
| 53 |
fill: tan; |
| 54 |
stroke: black; |
| 55 |
opacity: 0.5; |
| 56 |
shape-rendering: crispedges; |
| 57 |
} |
| 58 |
|
| 59 |
&-paths { |
| 60 |
stroke-width: var(--pf-t--chart--global--stroke--width--xs); |
| 61 |
shape-rendering: geometricprecision; |
| 62 |
|
| 63 |
> path { |
| 64 |
fill: var(--ct-plot-path-color); |
| 65 |
stroke: var(--ct-plot-path-color); |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
.ct-plot-title { |
| 71 |
fill: var(--pf-t--global--text--color--regular); |
| 72 |
} |
| 73 |
|
| 74 |
$plotColorCurrent: 0; |
| 75 |
$plotColorTotal: 0; |
| 76 |
|
| 77 |
// Count up total number of plot colors |
| 78 |
@each $plotColor in $plotColors { $plotColorTotal: $plotColorTotal + 1; } |
| 79 |
|
| 80 |
// Iterate through colors and set each graph area to a color |
| 81 |
@each $plotColor, $plotColorBackup in $plotColors { |
| 82 |
$plotColorCurrent: $plotColorCurrent + 1; |
| 83 |
.ct-plot-paths > path:nth-last-child(#{$plotColorTotal}n + #{$plotColorCurrent}) { |
| 84 |
--ct-plot-path-color: var(--pf-t--chart--color--#{$plotColor}, #{$plotColorBackup}); |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
// Make plot colors available to the entire page |
| 89 |
:root { |
| 90 |
--ct-plot-color-total: #{$plotColorTotal}; |
| 91 |
|
| 92 |
@for $i from 1 through $plotColorTotal { |
| 93 |
--ct-plot-color-#{i}: #{$plotColors[$i]}; |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
[dir="rtl"] { |
| 98 |
// Mirror the entire graph (placement & animation) |
| 99 |
.ct-plot { |
| 100 |
transform: scaleX(-1); |
| 101 |
|
| 102 |
// Flip the text back (so it's not a mirror image) |
| 103 |
text { |
| 104 |
transform: scaleX(-1); |
| 105 |
transform-origin: 50%; |
| 106 |
transform-box: fill-box; |
| 107 |
} |
| 108 |
|
| 109 |
// Set the anchor point for y-axis and units |
| 110 |
.ct-plot-axis-y text, |
| 111 |
.ct-plot-unit { |
| 112 |
transform-origin: 0%; |
| 113 |
} |
| 114 |
|
| 115 |
// Set the anchor point for the title |
| 116 |
.ct-plot-title { |
| 117 |
transform-origin: 100%; |
| 118 |
} |
| 119 |
} |
| 120 |
} |