You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/nimiq-colors/index.md
+16-13Lines changed: 16 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,14 +14,15 @@ The `nimiq-colors` package is the central source of truth for color definitions
14
14
The `nimiq-colors` package exports:
15
15
16
16
1.**CSS File**:
17
-
- Path: `nimiq-colors/dist/nimiq-colors.css`
18
-
- Contains CSS custom properties for all defined colors (e.g., `--nq-blue-500`, `--nq-neutral`) and gradients (e.g., `--nq-blue-gradient`).
19
-
- Automatically handles light and dark themes using `@media (prefers-color-scheme: dark)` and a `.dark` class selector.
17
+
18
+
- Path: `nimiq-colors/dist/nimiq-colors.css`
19
+
- Contains CSS custom properties for all defined colors (e.g., `--nq-blue-500`, `--nq-neutral`) and gradients (e.g., `--nq-blue-gradient`).
20
+
- Automatically handles light and dark themes using `@media (prefers-color-scheme: dark)` and a `.dark` class selector.
20
21
21
22
2.**TypeScript Modules**:
22
-
-Path: `nimiq-colors/src/colors.ts` (and `nimiq-colors/src/gradients.ts`, re-exported from `nimiq-colors/src/index.ts`)
23
-
-Provides the raw color definitions as TypeScript objects. Colors are typically defined with `light` and `dark` properties containing their oklch string values.
24
-
-Example: `import { blue, neutralGradient } from 'nimiq-colors/src';`
23
+
- Path: `nimiq-colors/src/colors.ts` (and `nimiq-colors/src/gradients.ts`, re-exported from `nimiq-colors/src/index.ts`)
24
+
- Provides the raw color definitions as TypeScript objects. Colors are typically defined with `light` and `dark` properties containing their oklch string values.
25
+
- Example: `import { blue, neutralGradient } from 'nimiq-colors/src';`
25
26
26
27
## Usage
27
28
@@ -32,34 +33,36 @@ If you are using the main `nimiq-css` package, the Nimiq colors CSS is automatic
32
33
If you want to use `nimiq-colors` directly in a project without the full `nimiq-css`:
33
34
34
35
```css
35
-
@import"nimiq-colors/dist/nimiq-colors.css";
36
+
@import'nimiq-colors/dist/nimiq-colors.css';
36
37
37
38
.my-element {
38
39
background-color: oklch(var(--nq-blue-500));
39
40
color: oklch(var(--nq-neutral-900));
40
41
}
41
42
```
43
+
42
44
(Note: Using `oklch(var(...))` is optional; `var(...)` works directly if the value is already a full color string, but oklch() ensures the context).
43
45
44
46
### TypeScript
45
47
46
48
You can import the TypeScript definitions for use in build scripts, theming engines, or JavaScript logic:
47
49
48
50
```typescript
49
-
import { blue, allColors, allGradients} from'nimiq-colors/src';// Or from 'nimiq-colors' if top-level export is configured for src
51
+
import { allColors, allGradients, blue} from'nimiq-colors/src'// Or from 'nimiq-colors' if top-level export is configured for src
50
52
51
53
// Accessing a specific color shade for light mode:
[View generated CSS from `nimiq-colors`](https://github.com/onmax/nimiq-ui/tree/main/packages/nimiq-colors/dist/nimiq-colors.css){.nq-arrow .nq-pill-tertiary .nq-raw}
9
9
10
-
11
10
## Usage
12
11
13
12
The necessary color CSS from `nimiq-colors` is automatically imported by `nimiq-css` via its main CSS file (`nimiq-css/dist/css/index.css`). You generally do not need to import it separately if you are using `nimiq-css`.
0 commit comments