Debian Codegraph @

src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss

raw
1 /*********************************************
2 * SASS Mixins
3 *********************************************/
4
5 /**
6 * A consistent box shadow style we apply across elements.
7 */
8 @mixin box-shadow() {
9 box-shadow:
10 0 0.2rem 0.5rem var(--pst-color-shadow),
11 0 0 0.0625rem var(--pst-color-shadow) !important;
12 }
13
14 /**
15 * Set background of some cell outputs to white-ish to make sure colors work
16 * This is because many libraries make output that only looks good on white
17 */
18 @mixin cell-output-background {
19 color: var(--pst-color-on-background);
20 background-color: var(--pst-color-text-base);
21 border-radius: 0.25rem;
22 padding: 0.5rem;
23 }
24
25 @mixin table-colors {
26 color: var(--pst-color-table);
27 border: 1px solid var(--pst-color-table-outer-border);
28
29 // Our tables are zebra striped: header rows and odd-numbered rows have an
30 // off-white background, or off-black in dark mode. So they require a
31 // higher contrast link color.
32 a {
33 color: var(--pst-color-link-higher-contrast);
34 }
35
36 th,
37 td {
38 ~ th,
39 ~ td {
40 border-left: 1px solid var(--pst-color-table-inner-border);
41 }
42 }
43
44 thead {
45 tr {
46 background-color: var(--pst-color-table-heading-bg);
47 border-bottom: 2px solid var(--pst-color-primary);
48 }
49 }
50
51 tbody {
52 tr {
53 &:nth-child(odd) {
54 background-color: var(--pst-color-table-row-zebra-low-bg);
55 }
56
57 &:nth-child(even) {
58 background-color: var(--pst-color-table-row-zebra-high-bg);
59 }
60 }
61 }
62 }
63
64 // Minimum mouse hit area
65 // ----------------------
66 // Ensures that the element has a minimum hit area that conforms to
67 // accessibility guidelines. For WCAG AA, we need 24px x 24px, see:
68 // https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html
69 @mixin min-hit-area() {
70 box-sizing: border-box;
71 min-width: 24px;
72 min-height: 24px;
73 }
74
75 // Meant to darken the element on hover in light mode, or
76 // lighten on hover in dark mode.
77 @mixin hover-darken-lighten {
78 &:hover {
79 filter: brightness(0.9);
80
81 html[data-theme="dark"] & {
82 filter: brightness(1.1);
83 }
84 }
85 }