Skip to content

Commit 2573e0a

Browse files
committed
feat(brand-example): Add color swatch page
1 parent c772164 commit 2573e0a

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

examples/brand/_colors.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,7 @@
110110
.bd-gray-800 { color: color-contrast($gray-800); background-color: $gray-800; }
111111
.bd-gray-900 { color: color-contrast($gray-900); background-color: $gray-900; }
112112

113-
.bd-white { color: color-contrast($white); background-color: $white; }
114-
.bd-black { color: color-contrast($black); background-color: $black; }
113+
.bd-white { color: color-contrast($white); background-color: $white; border: 2px solid $body-color;}
114+
.bd-black { color: color-contrast($black); background-color: $black; }
115+
.bd-foreground { color: $body-bg; background-color: $body-color; }
116+
.bd-background { color: $body-color; background-color: $body-bg; border: 2px solid $body-color;}

examples/brand/app.py

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
),
3030
ui.input_action_button("action1", "Action Button"),
3131
),
32-
ui.layout_column_wrap(
32+
ui.layout_columns(
3333
ui.value_box(
3434
"Metric 1",
3535
"100",
@@ -121,11 +121,11 @@
121121
),
122122
ui.input_password("password1", "Password Input"),
123123
),
124-
width=400,
124+
width=300,
125125
heights_equal=False,
126126
),
127127
),
128-
ui.nav_panel("Colors", ui.output_ui("ui_colors")),
128+
ui.nav_panel("Colors", ui.div(ui.output_ui("ui_colors"), class_="container-sm")),
129129
ui.nav_panel(
130130
"Documentation",
131131
ui.div(
@@ -286,22 +286,43 @@ def ui_colors():
286286
ui.div(f"{color}-{r}", class_=f"p-3 bd-{color}-{r}")
287287
for r in range(100, 1000, 100)
288288
],
289-
class_="col-md-4 mb-3",
289+
class_="mb-3",
290290
)
291291
]
292292

293293
return ui.TagList(
294+
ui.div(
295+
*[
296+
ui.div(
297+
ui.div(
298+
color, class_=f"p-3 mb-2 position-relative text-bg-{color}"
299+
),
300+
class_="col-md-3 mb-3",
301+
)
302+
for color in [
303+
"primary",
304+
"secondary",
305+
"dark",
306+
"light",
307+
"info",
308+
"success",
309+
"warning",
310+
"danger",
311+
]
312+
],
313+
class_="row font-monospace",
314+
),
294315
ui.div(
295316
*[
296317
ui.div(
297318
ui.div(color, class_=f"p-3 mb-2 position-relative bd-{color}"),
298-
class_="col-md-4 mb-3",
319+
class_="col-md-3 mb-3",
299320
)
300-
for color in ["black", "white"]
321+
for color in ["black", "white", "foreground", "background"]
301322
],
302323
class_="row font-monospace",
303324
),
304-
ui.div(*colors, class_="row font-monospace"),
325+
ui.layout_column_wrap(*colors, class_="font-monospace"),
305326
)
306327

307328

0 commit comments

Comments
 (0)