| 1 |
--- |
| 2 |
subtitle: Styling Components |
| 3 |
--- |
| 4 |
|
| 5 |
This tutorial explains how **Dome** style sheets are organized and how |
| 6 |
to reuse them for styling your own components. Although modern styling |
| 7 |
usually rely on _style preprocessors_ to leverage the complexity of |
| 8 |
CSS style sheets development, the approach used here is based on separation |
| 9 |
of concerns and multi-class styling. The advantage is that you can |
| 10 |
develop your _own_ style sheets, while still being able |
| 11 |
to re-use the existing classes provided by the framework. |
| 12 |
|
| 13 |
All CSS classes provided by **Dome** start with prefix `dome-` ; you shall not |
| 14 |
use such a prefix when designing your own classes. Many class names are provided |
| 15 |
with optional or mandatory variants. Typically: |
| 16 |
|
| 17 |
- `dome-<base>[-<a>,<b>,...]` describes class `dome-<base>` and its variants |
| 18 |
`dome-<base>-<a>`, `dome-<base>-<b>` _etc_. |
| 19 |
|
| 20 |
- `dome-<name>-[<a>,<b>,...]` describes classes `dome-<name>-<a>`, `dome-<name>-<b>` _etc_. |
| 21 |
|
| 22 |
## Platform Context |
| 23 |
|
| 24 |
These classes can be used when writing selectors in order to style things |
| 25 |
with respect to the target platform. The main window container is attributed |
| 26 |
with one of the following class: |
| 27 |
|
| 28 |
- `dome-platform-[darwin,linux,windows]` derived from the `process.darwin` |
| 29 |
global variable (**Node.js** environment). |
| 30 |
|
| 31 |
- `dome-window-[active|inactive]` depending on whether the main application window |
| 32 |
has focus or not. |
| 33 |
|
| 34 |
## Color Palettes |
| 35 |
|
| 36 |
Attributing colors to graphical elements is often an issue, since a precise |
| 37 |
hex variants shall be tuned depending on the surrounding context. However, |
| 38 |
base colors are provided in public classes for several usages: |
| 39 |
|
| 40 |
- `dome-color-frame` background, foreground and borders for |
| 41 |
window frames, which includes tool-bars, status-bars, tabs and such. |
| 42 |
Those colors actually depend on the focus state of the main application window. |
| 43 |
|
| 44 |
- `dome-color-[dragzone|dragging]` for painting the background of a dragging |
| 45 |
zone, typically a splitting rule. The `dragzone` variant is completely |
| 46 |
transparent with a very transparent light gray when hovered. |
| 47 |
The `dragging` variant is semi-transparent blended blue with light gray. |
| 48 |
All these drag background effects are smoothly transitioned. |
| 49 |
|
| 50 |
## Text Properties |
| 51 |
|
| 52 |
- `dome-text-[label|title|descr]` for labels (_eg._ buttons, tabs, menu |
| 53 |
entries), titles (larger labels) and descriptions (_eg._ tooltips). |
| 54 |
Uses a sans-serif font, is non-selectable and truncated with an ellipsis. |
| 55 |
|
| 56 |
- `dome-text-[data|code]` for selectable text, typically input fields. |
| 57 |
Uses a sans-serif font (for `data`) or monospace font (for `code`), |
| 58 |
never wraps and is clipped when overflow. |
| 59 |
|
| 60 |
## Component Layout |
| 61 |
|
| 62 |
The entire application uses the `box-model` box-sizing property by default, |
| 63 |
since it is usually much more consistent with nested `<div>` components. |
| 64 |
Similarly, default margins and paddings are set to `0px` to avoid unwanted |
| 65 |
messy background issues. |