@waaelg/dga-design-system 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1284 @@
1
+ # Colors
2
+
3
+ Color palettes, semantic utilities, and CSS classes for the DGA design system. Based on the Saudi Arabia Government Platforms Code Design System.
4
+
5
+ **Source:** `src/styles/utilities/colors.scss`
6
+
7
+ ---
8
+
9
+ ## Quick start (npm)
10
+
11
+ Import the stylesheet once — all color utilities are included:
12
+
13
+ ```js
14
+ import '@waaelg/dga-design-on-sass/style.css'
15
+ ```
16
+
17
+ ```html
18
+ <button class="dga-btn dga-btn-primary">Primary</button>
19
+ <p class="dga-text-gray-700">Muted text</p>
20
+ <div class="dga-bg-primary-50 dga-p-4">Tinted panel</div>
21
+ ```
22
+
23
+ | More | Doc |
24
+ |------|-----|
25
+ | Cheatsheet | [colors-cheatsheet.md](./colors-cheatsheet.md) |
26
+ | Hex swatches | [colors-swatches.md](./colors-swatches.md) |
27
+ | SCSS customization | [SCSS Variables](#scss-variables) (repo contributors) |
28
+
29
+ ---
30
+
31
+ ## Table of Contents
32
+
33
+ 1. [Overview](#overview)
34
+ 2. [Color Palettes](#color-palettes)
35
+ 3. [Semantic Colors](#semantic-colors)
36
+ 4. [Text Colors](#text-colors)
37
+ 5. [Background Colors](#background-colors)
38
+ 6. [Border Colors](#border-colors)
39
+ 7. [Gradients](#gradients)
40
+ 8. [Hover States](#hover-states)
41
+ 9. [Focus States](#focus-states)
42
+ 10. [Accessibility](#accessibility)
43
+ 11. [Usage Examples](#usage-examples)
44
+ 12. [SCSS Variables](#scss-variables)
45
+ 13. [CSS Custom Properties](#css-custom-properties)
46
+ 14. [Best Practices](#best-practices)
47
+
48
+ ---
49
+
50
+ ## Overview
51
+
52
+ The DGA Color System provides a comprehensive, accessible color palette inspired by the Saudi Arabian identity with Saudi Green as the primary color. The system includes:
53
+
54
+ - **8 Color Palettes** with 12 shades each (25-950)
55
+ - **Semantic Colors** for common UI states
56
+ - **Text Hierarchy** for typography
57
+ - **Gradients** based on Saudi Green
58
+ - **Auto-generated Utilities** for rapid development
59
+ - **Accessibility Helpers** for contrast checking
60
+
61
+ ### Color Scale
62
+
63
+ All color palettes follow a consistent scale from lightest to darkest:
64
+
65
+ | Shade | Use Case |
66
+ |-------|----------|
67
+ | 25 | Subtle backgrounds |
68
+ | 50 | Light backgrounds |
69
+ | 100 | Hover states (light) |
70
+ | 200 | Borders (light) |
71
+ | 300 | Disabled states |
72
+ | 400 | Placeholder text |
73
+ | 500 | **Primary/Default** |
74
+ | 600 | Hover states |
75
+ | 700 | Active states |
76
+ | 800 | Text on light backgrounds |
77
+ | 900 | Headers, emphasis |
78
+ | 950 | Maximum contrast |
79
+
80
+ ---
81
+
82
+ ## Color Palettes
83
+
84
+ ### 1. Gray (Neutral)
85
+
86
+ The neutral palette for text, backgrounds, and borders.
87
+
88
+ | Shade | Hex | Usage |
89
+ |-------|-----|-------|
90
+ | 25 | `#fcfcfd` | Body background |
91
+ | 50 | `#f9fafb` | Light background |
92
+ | 100 | `#f3f4f6` | Hover states |
93
+ | 200 | `#e5e7eb` | **Borders** |
94
+ | 300 | `#d2d6db` | Dividers |
95
+ | 400 | `#9da4ae` | Placeholder text |
96
+ | 500 | `#6c737f` | Icon color |
97
+ | 600 | `#4d5761` | **Muted text** |
98
+ | 700 | `#384250` | **Secondary text** |
99
+ | 800 | `#1f2a37` | Emphasis |
100
+ | 900 | `#111927` | Dark backgrounds |
101
+ | 950 | `#0d121c` | **Primary text** |
102
+
103
+ **Classes:**
104
+ ```html
105
+ <div class="dga-text-gray-950">Primary text</div>
106
+ <div class="dga-bg-gray-50">Light background</div>
107
+ <div class="dga-border-gray-200">Gray border</div>
108
+ ```
109
+
110
+ ---
111
+
112
+ ### 2. Primary (Saudi Green) 🇸🇦
113
+
114
+ The primary brand color representing Saudi Arabia.
115
+
116
+ | Shade | Hex | Usage |
117
+ |-------|-----|-------|
118
+ | 25 | `#f7fdf9` | Subtle green tint |
119
+ | 50 | `#f3fcf6` | Light green background |
120
+ | 100 | `#dff6e7` | Success messages background |
121
+ | 200 | `#b8eacb` | Hover states |
122
+ | 300 | `#88d8ad` | Active states |
123
+ | 400 | `#54c08a` | Decorative |
124
+ | 500 | `#25935f` | **Main Saudi Green** ⭐ |
125
+ | 600 | `#1b8354` | Hover on primary |
126
+ | 700 | `#166a45` | Active on primary |
127
+ | 800 | `#14573a` | **Brand text** |
128
+ | 900 | `#104631` | Dark accent |
129
+ | 950 | `#092a1e` | Maximum contrast |
130
+
131
+ **Classes:**
132
+ ```html
133
+ <button class="dga-bg-primary-500 dga-text-white">Primary Button</button>
134
+ <a class="dga-text-primary-600">Link</a>
135
+ <div class="dga-border-primary-500">Bordered element</div>
136
+ ```
137
+
138
+ **Semantic Mapping:**
139
+ - `.dga-bg-primary` = `#25935f` (Saudi Green 500)
140
+ - `.dga-text-primary` = `#0d121c` (Gray 950 for text hierarchy)
141
+ - `.dga-border-primary` = `#25935f`
142
+
143
+ ---
144
+
145
+ ### 3. Gold (Secondary)
146
+
147
+ Complementary color representing Saudi gold and luxury.
148
+
149
+ | Shade | Hex | Usage |
150
+ |-------|-----|-------|
151
+ | 25 | `#fffef7` | Subtle gold tint |
152
+ | 50 | `#fffef2` | Light gold background |
153
+ | 100 | `#fffce6` | Highlight |
154
+ | 200 | `#fcf3bd` | Soft accent |
155
+ | 300 | `#fae996` | Decorative |
156
+ | 400 | `#f7d54d` | Vibrant accent |
157
+ | 500 | `#f5bd02` | **Main Gold** ⭐ |
158
+ | 600 | `#dba102` | Hover |
159
+ | 700 | `#b87b02` | Active |
160
+ | 800 | `#945c01` | Text |
161
+ | 900 | `#6e3c00` | Dark accent |
162
+ | 950 | `#472400` | Maximum contrast |
163
+
164
+ **Classes:**
165
+ ```html
166
+ <div class="dga-bg-gold-500">Gold background</div>
167
+ <span class="dga-text-gold-700">Gold text</span>
168
+ <button class="dga-bg-secondary">Secondary Button</button>
169
+ ```
170
+
171
+ ---
172
+
173
+ ### 4. Lavender (Accent)
174
+
175
+ Elegant accent color for special highlights.
176
+
177
+ | Shade | Hex | Usage |
178
+ |-------|-----|-------|
179
+ | 25 | `#fefcff` | Subtle lavender |
180
+ | 50 | `#f9f5fa` | Light background |
181
+ | 100 | `#f2e9f5` | Soft accent |
182
+ | 200 | `#e1cce8` | Decorative |
183
+ | 300 | `#ccadd9` | Hover |
184
+ | 400 | `#a57bba` | Active |
185
+ | 500 | `#80519f` | **Main Lavender** ⭐ |
186
+ | 600 | `#6d428f` | Emphasis |
187
+ | 700 | `#532d75` | Strong accent |
188
+ | 800 | `#3d1d5e` | Text |
189
+ | 900 | `#281047` | Dark |
190
+ | 950 | `#16072e` | Maximum contrast |
191
+
192
+ **Classes:**
193
+ ```html
194
+ <div class="dga-bg-lavender-100">Lavender background</div>
195
+ <span class="dga-text-lavender-600">Lavender text</span>
196
+ ```
197
+
198
+ ---
199
+
200
+ ### 5. Error/Danger (Red)
201
+
202
+ For errors, alerts, and destructive actions.
203
+
204
+ | Shade | Hex | Usage |
205
+ |-------|-----|-------|
206
+ | 25 | `#fffbfa` | Subtle error tint |
207
+ | 50 | `#fef3f2` | Error background |
208
+ | 100 | `#fee4e2` | Alert background |
209
+ | 200 | `#fecdca` | Light error |
210
+ | 300 | `#fda29b` | Hover |
211
+ | 400 | `#f97066` | Active |
212
+ | 500 | `#f04438` | **Main Error** ⭐ |
213
+ | 600 | `#d92d20` | **Error text** |
214
+ | 700 | `#b42318` | Strong error |
215
+ | 800 | `#912018` | Dark error |
216
+ | 900 | `#7a271a` | Maximum error |
217
+ | 950 | `#55160c` | Error text on light |
218
+
219
+ **Classes:**
220
+ ```html
221
+ <div class="dga-bg-error-50 dga-text-error-700">Error message</div>
222
+ <button class="dga-bg-danger dga-text-white">Delete</button>
223
+ <span class="dga-text-error">Error text</span>
224
+ ```
225
+
226
+ ---
227
+
228
+ ### 6. Warning (Orange)
229
+
230
+ For warnings and cautionary messages.
231
+
232
+ | Shade | Hex | Usage |
233
+ |-------|-----|-------|
234
+ | 25 | `#fffcf5` | Subtle warning |
235
+ | 50 | `#fffaeb` | Warning background |
236
+ | 100 | `#fef0c7` | Alert background |
237
+ | 200 | `#fedf89` | Light warning |
238
+ | 300 | `#fec84b` | Hover |
239
+ | 400 | `#fdb022` | Active |
240
+ | 500 | `#f79009` | **Main Warning** ⭐ |
241
+ | 600 | `#dc6803` | **Warning text** |
242
+ | 700 | `#b54708` | Strong warning |
243
+ | 800 | `#93370d` | Dark warning |
244
+ | 900 | `#7a2e0e` | Maximum warning |
245
+ | 950 | `#4e1d09` | Deep contrast |
246
+
247
+ **Classes:**
248
+ ```html
249
+ <div class="dga-bg-warning-50 dga-text-warning-700">Warning</div>
250
+ <span class="dga-text-warning">Warning text</span>
251
+ ```
252
+
253
+ ---
254
+
255
+ ### 7. Info (Blue)
256
+
257
+ For informational messages and neutral highlights.
258
+
259
+ | Shade | Hex | Usage |
260
+ |-------|-----|-------|
261
+ | 25 | `#f5faff` | Subtle info |
262
+ | 50 | `#eff8ff` | Info background |
263
+ | 100 | `#d1e9ff` | Light info |
264
+ | 200 | `#b2ddff` | Soft accent |
265
+ | 300 | `#84caff` | Hover |
266
+ | 400 | `#53b1fd` | Active |
267
+ | 500 | `#2e90fa` | **Main Info** ⭐ |
268
+ | 600 | `#1570ef` | **Info text** |
269
+ | 700 | `#175cd3` | Strong info |
270
+ | 800 | `#1849a9` | Dark info |
271
+ | 900 | `#194185` | Maximum info |
272
+ | 950 | `#102a56` | Deep contrast |
273
+
274
+ **Classes:**
275
+ ```html
276
+ <div class="dga-bg-info-50 dga-text-info-700">Info message</div>
277
+ <span class="dga-text-info">Info text</span>
278
+ ```
279
+
280
+ ---
281
+
282
+ ### 8. Success (Green)
283
+
284
+ For success messages and positive actions.
285
+
286
+ | Shade | Hex | Usage |
287
+ |-------|-----|-------|
288
+ | 25 | `#f6fef9` | Subtle success |
289
+ | 50 | `#ecfdf3` | Success background |
290
+ | 100 | `#dcfae6` | Light success |
291
+ | 200 | `#abefc6` | Soft accent |
292
+ | 300 | `#75e0a7` | Hover |
293
+ | 400 | `#47cd89` | Active |
294
+ | 500 | `#17b26a` | **Main Success** ⭐ |
295
+ | 600 | `#079455` | **Success text** |
296
+ | 700 | `#067647` | Strong success |
297
+ | 800 | `#085d3a` | Dark success |
298
+ | 900 | `#074d31` | Maximum success |
299
+ | 950 | `#053321` | Deep contrast |
300
+
301
+ **Classes:**
302
+ ```html
303
+ <div class="dga-bg-success-50 dga-text-success-700">Success!</div>
304
+ <button class="dga-bg-success dga-text-white">Confirm</button>
305
+ ```
306
+
307
+ ---
308
+
309
+ ## Semantic Colors
310
+
311
+ Simplified semantic classes for common use cases.
312
+
313
+ ### Semantic Background Colors
314
+
315
+ ```html
316
+ <div class="dga-bg-primary">Saudi Green background</div>
317
+ <div class="dga-bg-secondary">Gold background</div>
318
+ <div class="dga-bg-success">Success background</div>
319
+ <div class="dga-bg-info">Info background</div>
320
+ <div class="dga-bg-warning">Warning background</div>
321
+ <div class="dga-bg-danger">Danger background</div>
322
+ <div class="dga-bg-light">Light gray background</div>
323
+ <div class="dga-bg-dark">Dark gray background</div>
324
+ ```
325
+
326
+ ### Semantic Border Colors
327
+
328
+ ```html
329
+ <div class="dga-border-primary">Primary border</div>
330
+ <div class="dga-border-secondary">Secondary border</div>
331
+ <div class="dga-border-success">Success border</div>
332
+ <div class="dga-border-danger">Danger border</div>
333
+ ```
334
+
335
+ ### Semantic Mapping
336
+
337
+ | Class | Maps To | Hex Value |
338
+ |-------|---------|-----------|
339
+ | `primary` | Saudi Green 500 | `#25935f` |
340
+ | `secondary` | Gold 500 | `#f5bd02` |
341
+ | `success` | Success 500 | `#17b26a` |
342
+ | `info` | Info 500 | `#2e90fa` |
343
+ | `warning` | Warning 500 | `#f79009` |
344
+ | `danger` | Error 500 | `#f04438` |
345
+ | `light` | Gray 50 | `#f9fafb` |
346
+ | `dark` | Gray 900 | `#111927` |
347
+
348
+ ---
349
+
350
+ ## Text Colors
351
+
352
+ ### Text Hierarchy
353
+
354
+ For optimal readability on light backgrounds:
355
+
356
+ ```html
357
+ <!-- Primary text (main content) -->
358
+ <p class="dga-text-primary">Main body text</p>
359
+ <!-- Gray 950: #0d121c -->
360
+
361
+ <!-- Secondary text (supporting content) -->
362
+ <p class="dga-text-secondary">Secondary text</p>
363
+ <!-- Gray 700: #384250 -->
364
+
365
+ <!-- Muted text (less important) -->
366
+ <p class="dga-text-muted">Muted text</p>
367
+ <!-- Gray 600: #4d5761 -->
368
+ ```
369
+
370
+ ### Basic Colors
371
+
372
+ ```html
373
+ <span class="dga-text-white">White text</span>
374
+ <span class="dga-text-black">Black text</span>
375
+ ```
376
+
377
+ ### Text for Dark Backgrounds
378
+
379
+ ```html
380
+ <div class="dga-bg-dark">
381
+ <p class="dga-text-inverse">White text on dark</p>
382
+ <p class="dga-text-inverse-muted">Muted white (70% opacity)</p>
383
+ </div>
384
+ ```
385
+
386
+ ### Brand Text Colors
387
+
388
+ ```html
389
+ <h1 class="dga-text-brand">Brand heading</h1>
390
+ <!-- SA 800: #14573a -->
391
+
392
+ <p class="dga-text-brand-secondary">Brand secondary</p>
393
+ <!-- SA 600: #1b8354 -->
394
+ ```
395
+
396
+ ### Semantic Text Colors
397
+
398
+ ```html
399
+ <span class="dga-text-error">Error message</span>
400
+ <span class="dga-text-warning">Warning message</span>
401
+ <span class="dga-text-success">Success message</span>
402
+ <span class="dga-text-info">Info message</span>
403
+ <span class="dga-text-danger">Danger (same as error)</span>
404
+ <span class="dga-text-light">Light text</span>
405
+ <span class="dga-text-dark">Dark text</span>
406
+ ```
407
+
408
+ ### Color Shade Text
409
+
410
+ Access any shade directly:
411
+
412
+ ```html
413
+ <span class="dga-text-primary-500">Saudi Green text</span>
414
+ <span class="dga-text-gray-600">Gray 600 text</span>
415
+ <span class="dga-text-gold-700">Gold 700 text</span>
416
+ ```
417
+
418
+ **Pattern:** `.dga-text-{palette}-{shade}`
419
+
420
+ ---
421
+
422
+ ## Background Colors
423
+
424
+ ### Semantic Backgrounds
425
+
426
+ ```html
427
+ <div class="dga-bg-primary dga-text-white">Primary</div>
428
+ <div class="dga-bg-secondary dga-text-black">Secondary</div>
429
+ <div class="dga-bg-success dga-text-white">Success</div>
430
+ <div class="dga-bg-danger dga-text-white">Danger</div>
431
+ <div class="dga-bg-light">Light</div>
432
+ <div class="dga-bg-dark dga-text-white">Dark</div>
433
+ ```
434
+
435
+ ### Color Shade Backgrounds
436
+
437
+ ```html
438
+ <div class="dga-bg-primary-50">Light green background</div>
439
+ <div class="dga-bg-primary-500">Main green background</div>
440
+ <div class="dga-bg-gray-100">Light gray background</div>
441
+ <div class="dga-bg-error-50">Error background</div>
442
+ ```
443
+
444
+ **Pattern:** `.dga-bg-{palette}-{shade}`
445
+
446
+ ### Alert Backgrounds
447
+
448
+ ```html
449
+ <!-- Error alert -->
450
+ <div class="dga-bg-error-50 dga-border dga-border-error-200 dga-text-error-700">
451
+ <strong>Error:</strong> Something went wrong
452
+ </div>
453
+
454
+ <!-- Warning alert -->
455
+ <div class="dga-bg-warning-50 dga-border dga-border-warning-200 dga-text-warning-700">
456
+ <strong>Warning:</strong> Please be careful
457
+ </div>
458
+
459
+ <!-- Success alert -->
460
+ <div class="dga-bg-success-50 dga-border dga-border-success-200 dga-text-success-700">
461
+ <strong>Success:</strong> Action completed
462
+ </div>
463
+
464
+ <!-- Info alert -->
465
+ <div class="dga-bg-info-50 dga-border dga-border-info-200 dga-text-info-700">
466
+ <strong>Info:</strong> Did you know?
467
+ </div>
468
+ ```
469
+
470
+ ---
471
+
472
+ ## Border Colors
473
+
474
+ ### Basic Borders
475
+
476
+ ```html
477
+ <!-- Default border (gray-200) -->
478
+ <div class="dga-border">Default border</div>
479
+
480
+ <!-- Light border (gray-100) -->
481
+ <div class="dga-border-light">Light border</div>
482
+
483
+ <!-- Directional borders -->
484
+ <div class="dga-border-top">Top border only</div>
485
+ <div class="dga-border-right">Right border only</div>
486
+ <div class="dga-border-bottom">Bottom border only</div>
487
+ <div class="dga-border-left">Left border only</div>
488
+
489
+ <!-- No border -->
490
+ <div class="dga-border-none">No border</div>
491
+ ```
492
+
493
+ ### Semantic Border Colors
494
+
495
+ ```html
496
+ <div class="dga-border dga-border-primary">Primary border</div>
497
+ <div class="dga-border dga-border-success">Success border</div>
498
+ <div class="dga-border dga-border-danger">Danger border</div>
499
+ ```
500
+
501
+ ### Color Shade Borders
502
+
503
+ ```html
504
+ <div class="dga-border dga-border-primary-300">Light green border</div>
505
+ <div class="dga-border dga-border-gray-300">Gray border</div>
506
+ <div class="dga-border dga-border-error-500">Error border</div>
507
+ ```
508
+
509
+ **Pattern:** `.dga-border-{palette}-{shade}`
510
+
511
+ **Note:** Border utilities only set `border-color`. Use `.dga-border` to add the actual border.
512
+
513
+ ---
514
+
515
+ ## Gradients
516
+
517
+ Saudi Green gradients for hero sections, cards, and backgrounds.
518
+
519
+ ```html
520
+ <!-- Primary gradient (horizontal) -->
521
+ <div class="dga-bg-gradient-primary">
522
+ <!-- linear-gradient(90deg, #1b8354, #25935f) -->
523
+ </div>
524
+
525
+ <!-- Secondary gradient (diagonal) -->
526
+ <div class="dga-bg-gradient-secondary">
527
+ <!-- linear-gradient(45deg, #166a45, #1b8354) -->
528
+ </div>
529
+
530
+ <!-- Dark gradient -->
531
+ <div class="dga-bg-gradient-dark">
532
+ <!-- linear-gradient(45deg, #092a1e, #1b8354) -->
533
+ </div>
534
+
535
+ <!-- Medium gradient -->
536
+ <div class="dga-bg-gradient-medium">
537
+ <!-- linear-gradient(90deg, #14573a, #1b8354) -->
538
+ </div>
539
+
540
+ <!-- Subtle gradient -->
541
+ <div class="dga-bg-gradient-subtle">
542
+ <!-- linear-gradient(26.5deg, #14573a, #166a45) -->
543
+ </div>
544
+
545
+ <!-- Deep gradient -->
546
+ <div class="dga-bg-gradient-deep">
547
+ <!-- linear-gradient(45deg, #104631, #1b8354) -->
548
+ </div>
549
+ ```
550
+
551
+ ### Gradient Use Cases
552
+
553
+ ```html
554
+ <!-- Hero section -->
555
+ <section class="dga-bg-gradient-primary dga-text-white">
556
+ <h1>Welcome to DGA</h1>
557
+ <p>Government Digital Platform</p>
558
+ </section>
559
+
560
+ <!-- Card header -->
561
+ <div class="card">
562
+ <div class="dga-bg-gradient-subtle dga-text-white">
563
+ <h3>Card Title</h3>
564
+ </div>
565
+ <div class="card-body">Content</div>
566
+ </div>
567
+
568
+ <!-- Button gradient -->
569
+ <button class="dga-bg-gradient-primary dga-text-white">
570
+ Get Started
571
+ </button>
572
+ ```
573
+
574
+ ---
575
+
576
+ ## Hover States
577
+
578
+ Apply colors on hover.
579
+
580
+ ```html
581
+ <!-- Background hover -->
582
+ <button class="dga-bg-primary-500-hover">
583
+ Hover me for green background
584
+ </button>
585
+
586
+ <!-- Text hover -->
587
+ <a href="#" class="dga-text-primary-600-hover">
588
+ Link with hover
589
+ </a>
590
+
591
+ <!-- Border hover -->
592
+ <div class="dga-border dga-border-gray-300-hover">
593
+ Hover for gray border
594
+ </div>
595
+ ```
596
+
597
+ **Pattern:** `.dga-{property}-{palette}-{shade}-hover:hover`
598
+
599
+ ### Interactive Button Example
600
+
601
+ ```html
602
+ <button class="dga-bg-primary-500 dga-bg-primary-600-hover dga-text-white">
603
+ Primary Button (changes shade on hover)
604
+ </button>
605
+ ```
606
+
607
+ ---
608
+
609
+ ## Focus States
610
+
611
+ Custom focus ring styles for interactive elements.
612
+
613
+ ```html
614
+ <!-- Default focus ring (primary color) -->
615
+ <input type="text" class="dga-focus-ring">
616
+
617
+ <!-- Primary focus -->
618
+ <input type="text" class="dga-focus-ring-primary">
619
+
620
+ <!-- Error focus -->
621
+ <input type="text" class="dga-focus-ring-error">
622
+
623
+ <!-- Warning focus -->
624
+ <input type="text" class="dga-focus-ring-warning">
625
+
626
+ <!-- Success focus -->
627
+ <input type="text" class="dga-focus-ring-success">
628
+
629
+ <!-- Info focus -->
630
+ <input type="text" class="dga-focus-ring-info">
631
+ ```
632
+
633
+ All focus rings:
634
+ - Remove default outline
635
+ - Add colored box-shadow with 25% opacity
636
+ - Ring size: 0.2rem (3.2px)
637
+
638
+ ---
639
+
640
+ ## Accessibility
641
+
642
+ ### Contrast Checking
643
+
644
+ The system includes helper functions for accessibility:
645
+
646
+ ```scss
647
+ // SCSS Function - checks if color is light or dark
648
+ @function dga-color-contrast($color) {
649
+ @if (lightness($color) > 50) {
650
+ @return $dga-text-primary; // Dark text for light backgrounds
651
+ } @else {
652
+ @return $dga-text-inverse; // Light text for dark backgrounds
653
+ }
654
+ }
655
+
656
+ // Get accessible text color for any background
657
+ @function dga-text-color($bg-color) {
658
+ @return dga-color-contrast($bg-color);
659
+ }
660
+ ```
661
+
662
+ **Usage in SCSS:**
663
+ ```scss
664
+ .my-component {
665
+ background-color: $dga-primary-500;
666
+ color: dga-text-color($dga-primary-500); // Auto-selects white
667
+ }
668
+ ```
669
+
670
+ ### Accessible Color Combinations
671
+
672
+ ✅ **Good Contrast** (WCAG AA compliant):
673
+
674
+ ```html
675
+ <!-- Light backgrounds -->
676
+ <div class="dga-bg-white dga-text-primary">Primary text on white</div>
677
+ <div class="dga-bg-gray-50 dga-text-secondary">Secondary text</div>
678
+
679
+ <!-- Dark backgrounds -->
680
+ <div class="dga-bg-primary-500 dga-text-white">White on Saudi Green</div>
681
+ <div class="dga-bg-dark dga-text-inverse">White on dark</div>
682
+
683
+ <!-- Semantic colors -->
684
+ <div class="dga-bg-error-50 dga-text-error-700">Error message</div>
685
+ <div class="dga-bg-success-50 dga-text-success-700">Success message</div>
686
+ ```
687
+
688
+ ❌ **Poor Contrast** (avoid):
689
+
690
+ ```html
691
+ <!-- Don't use light text on light backgrounds -->
692
+ <div class="dga-bg-gray-100 dga-text-gray-300">❌ Poor contrast</div>
693
+
694
+ <!-- Don't use dark text on dark backgrounds -->
695
+ <div class="dga-bg-primary-900 dga-text-primary-800">❌ Poor contrast</div>
696
+ ```
697
+
698
+ ### Recommended Text-on-Background Combinations
699
+
700
+ | Background | Recommended Text Colors |
701
+ |------------|------------------------|
702
+ | `bg-white` | `text-primary`, `text-secondary`, `text-muted` |
703
+ | `bg-gray-50` | `text-primary`, `text-secondary` |
704
+ | `bg-primary-500` | `text-white`, `text-inverse` |
705
+ | `bg-dark` | `text-white`, `text-inverse` |
706
+ | `bg-error-50` | `text-error-700`, `text-error-800` |
707
+ | `bg-success-50` | `text-success-700` |
708
+
709
+ ---
710
+
711
+ ## Usage Examples
712
+
713
+ ### Example 1: Alert Components
714
+
715
+ ```html
716
+ <!-- Error Alert -->
717
+ <div class="dga-bg-error-50 dga-border dga-border-error-200 dga-text-error-700"
718
+ style="padding: 16px; border-radius: 8px; margin-bottom: 16px;">
719
+ <div style="display: flex; align-items: start; gap: 12px;">
720
+ <svg width="20" height="20" class="dga-text-error-500">
721
+ <!-- Error icon -->
722
+ </svg>
723
+ <div>
724
+ <h4 class="dga-text-error-800" style="margin: 0 0 4px;">Error</h4>
725
+ <p style="margin: 0;">Something went wrong. Please try again.</p>
726
+ </div>
727
+ </div>
728
+ </div>
729
+
730
+ <!-- Success Alert -->
731
+ <div class="dga-bg-success-50 dga-border dga-border-success-200 dga-text-success-700"
732
+ style="padding: 16px; border-radius: 8px;">
733
+ <div style="display: flex; align-items: start; gap: 12px;">
734
+ <svg width="20" height="20" class="dga-text-success-500">
735
+ <!-- Success icon -->
736
+ </svg>
737
+ <div>
738
+ <h4 class="dga-text-success-800" style="margin: 0 0 4px;">Success</h4>
739
+ <p style="margin: 0;">Your changes have been saved successfully.</p>
740
+ </div>
741
+ </div>
742
+ </div>
743
+ ```
744
+
745
+ ### Example 2: Button Variants
746
+
747
+ ```html
748
+ <!-- Primary button -->
749
+ <button class="dga-bg-primary-500 dga-bg-primary-600-hover dga-text-white dga-focus-ring-primary"
750
+ style="padding: 12px 24px; border: none; border-radius: 8px; cursor: pointer;">
751
+ Primary Action
752
+ </button>
753
+
754
+ <!-- Secondary button -->
755
+ <button class="dga-bg-white dga-border dga-border-primary-500 dga-text-primary-600 dga-bg-primary-50-hover"
756
+ style="padding: 12px 24px; border-radius: 8px; cursor: pointer;">
757
+ Secondary Action
758
+ </button>
759
+
760
+ <!-- Danger button -->
761
+ <button class="dga-bg-error-500 dga-bg-error-600-hover dga-text-white dga-focus-ring-error"
762
+ style="padding: 12px 24px; border: none; border-radius: 8px; cursor: pointer;">
763
+ Delete
764
+ </button>
765
+
766
+ <!-- Ghost button -->
767
+ <button class="dga-bg-transparent dga-text-primary-600 dga-text-primary-700-hover"
768
+ style="padding: 12px 24px; border: none; background: transparent; cursor: pointer;">
769
+ Ghost Button
770
+ </button>
771
+ ```
772
+
773
+ ### Example 3: Card with Gradient Header
774
+
775
+ ```html
776
+ <div class="dga-bg-white dga-border dga-border-gray-200"
777
+ style="border-radius: 12px; overflow: hidden;">
778
+ <!-- Gradient header -->
779
+ <div class="dga-bg-gradient-primary dga-text-white"
780
+ style="padding: 24px;">
781
+ <h3 style="margin: 0 0 8px;">Government Services</h3>
782
+ <p style="margin: 0; opacity: 0.9;">Access digital platforms</p>
783
+ </div>
784
+
785
+ <!-- Card body -->
786
+ <div style="padding: 24px;">
787
+ <p class="dga-text-secondary">
788
+ Access all government digital services in one place.
789
+ </p>
790
+ <button class="dga-bg-primary-500 dga-text-white"
791
+ style="padding: 8px 16px; border: none; border-radius: 6px; margin-top: 16px;">
792
+ Learn More
793
+ </button>
794
+ </div>
795
+ </div>
796
+ ```
797
+
798
+ ### Example 4: Form Input with States
799
+
800
+ ```html
801
+ <!-- Normal state -->
802
+ <input type="text"
803
+ class="dga-border dga-border-gray-300 dga-focus-ring-primary"
804
+ placeholder="Enter your name"
805
+ style="width: 100%; padding: 12px; border-radius: 8px;">
806
+
807
+ <!-- Error state -->
808
+ <input type="email"
809
+ class="dga-border dga-border-error-500 dga-bg-error-50 dga-focus-ring-error"
810
+ placeholder="Email"
811
+ style="width: 100%; padding: 12px; border-radius: 8px;">
812
+ <p class="dga-text-error-600" style="margin: 4px 0 0; font-size: 14px;">
813
+ Please enter a valid email
814
+ </p>
815
+
816
+ <!-- Success state -->
817
+ <input type="text"
818
+ class="dga-border dga-border-success-500 dga-bg-success-50"
819
+ value="john@example.com"
820
+ style="width: 100%; padding: 12px; border-radius: 8px;">
821
+ <p class="dga-text-success-600" style="margin: 4px 0 0; font-size: 14px;">
822
+ ✓ Email verified
823
+ </p>
824
+ ```
825
+
826
+ ### Example 5: Badge Collection
827
+
828
+ ```html
829
+ <span class="dga-bg-primary-100 dga-text-primary-700"
830
+ style="padding: 4px 12px; border-radius: 16px; font-size: 14px;">
831
+ Active
832
+ </span>
833
+
834
+ <span class="dga-bg-success-100 dga-text-success-700"
835
+ style="padding: 4px 12px; border-radius: 16px; font-size: 14px;">
836
+ Completed
837
+ </span>
838
+
839
+ <span class="dga-bg-warning-100 dga-text-warning-700"
840
+ style="padding: 4px 12px; border-radius: 16px; font-size: 14px;">
841
+ Pending
842
+ </span>
843
+
844
+ <span class="dga-bg-error-100 dga-text-error-700"
845
+ style="padding: 4px 12px; border-radius: 16px; font-size: 14px;">
846
+ Failed
847
+ </span>
848
+
849
+ <span class="dga-bg-gray-100 dga-text-gray-700"
850
+ style="padding: 4px 12px; border-radius: 16px; font-size: 14px;">
851
+ Draft
852
+ </span>
853
+ ```
854
+
855
+ ### Example 6: Hero Section
856
+
857
+ ```html
858
+ <section class="dga-bg-gradient-primary dga-text-white"
859
+ style="padding: 80px 20px; text-align: center;">
860
+ <div style="max-width: 800px; margin: 0 auto;">
861
+ <h1 style="font-size: 48px; margin: 0 0 16px;">
862
+ Saudi Digital Government
863
+ </h1>
864
+ <p style="font-size: 20px; margin: 0 0 32px; opacity: 0.95;">
865
+ Transforming government services through digital innovation
866
+ </p>
867
+ <div style="display: flex; gap: 16px; justify-content: center;">
868
+ <button class="dga-bg-white dga-text-primary-600"
869
+ style="padding: 16px 32px; border: none; border-radius: 8px; font-size: 16px; font-weight: 600;">
870
+ Get Started
871
+ </button>
872
+ <button class="dga-bg-transparent dga-border dga-border-white dga-text-white"
873
+ style="padding: 16px 32px; border-radius: 8px; font-size: 16px; font-weight: 600; background: transparent;">
874
+ Learn More
875
+ </button>
876
+ </div>
877
+ </div>
878
+ </section>
879
+ ```
880
+
881
+ ### Example 7: Status Indicators
882
+
883
+ ```html
884
+ <div style="display: flex; gap: 16px; align-items: center;">
885
+ <!-- Online -->
886
+ <div style="display: flex; align-items: center; gap: 8px;">
887
+ <div class="dga-bg-success-500"
888
+ style="width: 8px; height: 8px; border-radius: 50%;"></div>
889
+ <span class="dga-text-secondary">Online</span>
890
+ </div>
891
+
892
+ <!-- Away -->
893
+ <div style="display: flex; align-items: center; gap: 8px;">
894
+ <div class="dga-bg-warning-500"
895
+ style="width: 8px; height: 8px; border-radius: 50%;"></div>
896
+ <span class="dga-text-secondary">Away</span>
897
+ </div>
898
+
899
+ <!-- Offline -->
900
+ <div style="display: flex; align-items: center; gap: 8px;">
901
+ <div class="dga-bg-gray-400"
902
+ style="width: 8px; height: 8px; border-radius: 50%;"></div>
903
+ <span class="dga-text-secondary">Offline</span>
904
+ </div>
905
+ </div>
906
+ ```
907
+
908
+ ---
909
+
910
+ ## SCSS Variables
911
+
912
+ ### Using Color Variables in SCSS
913
+
914
+ ```scss
915
+ // Import colors
916
+ @import 'variables/colors';
917
+
918
+ // Use color variables
919
+ .my-component {
920
+ background-color: $dga-primary-500;
921
+ color: $dga-text-white;
922
+ border: 1px solid $dga-primary-600;
923
+
924
+ &:hover {
925
+ background-color: $dga-primary-600;
926
+ }
927
+ }
928
+
929
+ // Use semantic colors
930
+ .button-primary {
931
+ background-color: $dga-semantic-primary;
932
+ color: white;
933
+ }
934
+
935
+ // Use gradients
936
+ .hero {
937
+ background: $dga-gradient-sa-primary;
938
+ }
939
+
940
+ // Use text colors
941
+ .heading {
942
+ color: $dga-text-primary;
943
+ }
944
+
945
+ .subheading {
946
+ color: $dga-text-secondary;
947
+ }
948
+ ```
949
+
950
+ ### Available SCSS Variables
951
+
952
+ **Gray Palette:**
953
+ ```scss
954
+ $dga-gray-25 through $dga-gray-950
955
+ ```
956
+
957
+ **Primary (Saudi Green):**
958
+ ```scss
959
+ $dga-sa-25 through $dga-sa-950
960
+ // Or use: $dga-primary map
961
+ ```
962
+
963
+ **Secondary Palettes:**
964
+ ```scss
965
+ $dga-gold-25 through $dga-gold-950
966
+ $dga-lavender-25 through $dga-lavender-950
967
+ ```
968
+
969
+ **Semantic Colors:**
970
+ ```scss
971
+ $dga-error-25 through $dga-error-950
972
+ $dga-warning-25 through $dga-warning-950
973
+ $dga-info-25 through $dga-info-950
974
+ $dga-success-25 through $dga-success-950
975
+ ```
976
+
977
+ **Semantic Mappings:**
978
+ ```scss
979
+ $dga-semantic-primary // Saudi Green 500
980
+ $dga-semantic-secondary // Gold 500
981
+ $dga-semantic-success // Success 500
982
+ $dga-semantic-info // Info 500
983
+ $dga-semantic-warning // Warning 500
984
+ $dga-semantic-danger // Error 500
985
+ $dga-semantic-light // Gray 50
986
+ $dga-semantic-dark // Gray 900
987
+ ```
988
+
989
+ **Text Colors:**
990
+ ```scss
991
+ $dga-text-white
992
+ $dga-text-black
993
+ $dga-text-primary // Gray 950
994
+ $dga-text-secondary // Gray 700
995
+ $dga-text-muted // Gray 600
996
+ $dga-text-inverse // White
997
+ $dga-text-inverse-muted // White 70%
998
+ $dga-text-brand // SA 800
999
+ $dga-text-brand-secondary // SA 600
1000
+ $dga-text-error // Error 600
1001
+ $dga-text-warning // Warning 600
1002
+ $dga-text-success // Success 600
1003
+ $dga-text-info // Info 600
1004
+ ```
1005
+
1006
+ **Component Defaults:**
1007
+ ```scss
1008
+ $dga-body-bg // Gray 25
1009
+ $dga-body-color // Text primary
1010
+ $dga-link-color // Saudi Green
1011
+ $dga-link-hover-color // Saudi Green 600
1012
+ $dga-border-color // Gray 200
1013
+ $dga-border-color-light // Gray 100
1014
+ $dga-component-bg // White
1015
+ $dga-focus-ring-color // Primary 25% opacity
1016
+ ```
1017
+
1018
+ ---
1019
+
1020
+ ## CSS Custom Properties
1021
+
1022
+ All colors are available as CSS custom properties (CSS variables) for JavaScript access.
1023
+
1024
+ ### Using CSS Variables
1025
+
1026
+ ```css
1027
+ /* Access colors in CSS */
1028
+ .my-element {
1029
+ background-color: var(--dga-primary-500);
1030
+ color: var(--dga-gray-950);
1031
+ border-color: var(--dga-primary-300);
1032
+ }
1033
+
1034
+ /* Dynamic theming */
1035
+ :root {
1036
+ --my-brand-color: var(--dga-primary-500);
1037
+ }
1038
+
1039
+ .branded-element {
1040
+ background: var(--my-brand-color);
1041
+ }
1042
+ ```
1043
+
1044
+ ### JavaScript Access
1045
+
1046
+ ```javascript
1047
+ // Get color value
1048
+ const primaryColor = getComputedStyle(document.documentElement)
1049
+ .getPropertyValue('--dga-primary-500');
1050
+
1051
+ console.log(primaryColor); // #25935f
1052
+
1053
+ // Set color dynamically
1054
+ document.documentElement.style
1055
+ .setProperty('--dga-primary-500', '#ff0000');
1056
+ ```
1057
+
1058
+ ### Available CSS Variables
1059
+
1060
+ **Format:** `--dga-{palette}-{shade}`
1061
+
1062
+ Examples:
1063
+ ```css
1064
+ --dga-gray-50
1065
+ --dga-gray-950
1066
+ --dga-primary-500
1067
+ --dga-gold-500
1068
+ --dga-lavender-500
1069
+ --dga-error-500
1070
+ --dga-warning-500
1071
+ --dga-info-500
1072
+ --dga-success-500
1073
+ ```
1074
+
1075
+ ---
1076
+
1077
+ ## Best Practices
1078
+
1079
+ ### 1. Use Semantic Colors for UI States
1080
+
1081
+ ✅ **Good:**
1082
+ ```html
1083
+ <button class="dga-bg-primary">Primary Action</button>
1084
+ <button class="dga-bg-danger">Delete</button>
1085
+ <div class="dga-bg-success-50 dga-text-success">Success message</div>
1086
+ ```
1087
+
1088
+ ❌ **Avoid:**
1089
+ ```html
1090
+ <button class="dga-bg-primary-500">Primary Action</button>
1091
+ <button class="dga-bg-error-500">Delete</button>
1092
+ ```
1093
+
1094
+ **Why:** Semantic classes are easier to maintain and understand.
1095
+
1096
+ ---
1097
+
1098
+ ### 2. Follow Text Hierarchy
1099
+
1100
+ ✅ **Good:**
1101
+ ```html
1102
+ <h1 class="dga-text-primary">Main Heading</h1>
1103
+ <p class="dga-text-secondary">Supporting text</p>
1104
+ <small class="dga-text-muted">Additional info</small>
1105
+ ```
1106
+
1107
+ ❌ **Avoid:**
1108
+ ```html
1109
+ <h1 class="dga-text-gray-950">Main Heading</h1>
1110
+ <p class="dga-text-gray-700">Supporting text</p>
1111
+ ```
1112
+
1113
+ ---
1114
+
1115
+ ### 3. Ensure Sufficient Contrast
1116
+
1117
+ ✅ **Good:**
1118
+ ```html
1119
+ <div class="dga-bg-white dga-text-primary">High contrast</div>
1120
+ <div class="dga-bg-primary-500 dga-text-white">Good contrast</div>
1121
+ ```
1122
+
1123
+ ❌ **Avoid:**
1124
+ ```html
1125
+ <div class="dga-bg-gray-100 dga-text-gray-300">Poor contrast</div>
1126
+ ```
1127
+
1128
+ **Use:** WCAG AA standard (4.5:1 for normal text)
1129
+
1130
+ ---
1131
+
1132
+ ### 4. Use Light Backgrounds for Alerts
1133
+
1134
+ ✅ **Good:**
1135
+ ```html
1136
+ <div class="dga-bg-error-50 dga-text-error-700">Error message</div>
1137
+ ```
1138
+
1139
+ ❌ **Avoid:**
1140
+ ```html
1141
+ <div class="dga-bg-error-500 dga-text-white">Error message</div>
1142
+ ```
1143
+
1144
+ **Why:** Light backgrounds are less alarming and more readable.
1145
+
1146
+ ---
1147
+
1148
+ ### 5. Consistent Focus States
1149
+
1150
+ Always add focus states to interactive elements:
1151
+
1152
+ ```html
1153
+ <input class="dga-focus-ring-primary">
1154
+ <button class="dga-focus-ring">Click me</button>
1155
+ <a href="#" class="dga-focus-ring">Link</a>
1156
+ ```
1157
+
1158
+ ---
1159
+
1160
+ ### 6. Use Gradients Sparingly
1161
+
1162
+ ✅ **Good uses:**
1163
+ - Hero sections
1164
+ - Card headers
1165
+ - Call-to-action backgrounds
1166
+
1167
+ ❌ **Avoid:**
1168
+ - Body text backgrounds
1169
+ - Form inputs
1170
+ - Small UI elements
1171
+
1172
+ ---
1173
+
1174
+ ### 7. Maintain Brand Consistency
1175
+
1176
+ Always use Saudi Green (`primary-500`) as the primary brand color:
1177
+
1178
+ ```html
1179
+ <button class="dga-bg-primary-500">Primary Button</button>
1180
+ <a class="dga-text-primary-600">Link</a>
1181
+ ```
1182
+
1183
+ ---
1184
+
1185
+ ### 8. Use Gold as Accent
1186
+
1187
+ Gold should complement, not dominate:
1188
+
1189
+ ```html
1190
+ <!-- Good: Gold as accent -->
1191
+ <div class="dga-bg-white">
1192
+ <h2 class="dga-text-primary-700">Title</h2>
1193
+ <span class="dga-bg-gold-100 dga-text-gold-700">Premium</span>
1194
+ </div>
1195
+ ```
1196
+
1197
+ ---
1198
+
1199
+ ## Color Utility Reference
1200
+
1201
+ ### Quick Reference Table
1202
+
1203
+ | Utility Type | Pattern | Example |
1204
+ |--------------|---------|---------|
1205
+ | Text color | `.dga-text-{color}-{shade}` | `.dga-text-primary-500` |
1206
+ | Background | `.dga-bg-{color}-{shade}` | `.dga-bg-gray-50` |
1207
+ | Border color | `.dga-border-{color}-{shade}` | `.dga-border-primary-300` |
1208
+ | Gradient | `.dga-bg-gradient-{name}` | `.dga-bg-gradient-primary` |
1209
+ | Hover | `.dga-{property}-{color}-{shade}-hover` | `.dga-bg-primary-600-hover` |
1210
+ | Focus | `.dga-focus-ring-{semantic}` | `.dga-focus-ring-primary` |
1211
+ | Semantic | `.dga-{property}-{semantic}` | `.dga-bg-success` |
1212
+ | Text hierarchy | `.dga-text-{type}` | `.dga-text-primary` |
1213
+
1214
+ ---
1215
+
1216
+ ## Migration & Customization
1217
+
1218
+ ### Customizing Colors
1219
+
1220
+ To customize the color system, override variables before importing:
1221
+
1222
+ ```scss
1223
+ // Custom primary color (if not using Saudi Green)
1224
+ $dga-sa-500: #custom-color;
1225
+
1226
+ // Custom secondary color
1227
+ $dga-gold-500: #custom-gold;
1228
+
1229
+ // Then import
1230
+ @import 'variables/colors';
1231
+ @import 'utilities/colors';
1232
+ ```
1233
+
1234
+ ### Extending the Palette
1235
+
1236
+ Add custom color shades:
1237
+
1238
+ ```scss
1239
+ // Add custom color
1240
+ $my-brand-500: #ff6b6b;
1241
+
1242
+ $dga-custom: (
1243
+ "500": $my-brand-500,
1244
+ );
1245
+
1246
+ // Generate utilities
1247
+ @include generate-color-utilities((
1248
+ "custom-color": (
1249
+ "prefix": "custom",
1250
+ "property": "color",
1251
+ "colors": (
1252
+ "brand": $dga-custom
1253
+ )
1254
+ )
1255
+ ));
1256
+ ```
1257
+
1258
+ ---
1259
+
1260
+ ## Browser Support
1261
+
1262
+ All color utilities support:
1263
+
1264
+ - ✅ Chrome (all versions)
1265
+ - ✅ Firefox (all versions)
1266
+ - ✅ Safari (all versions)
1267
+ - ✅ Edge (all versions)
1268
+ - ✅ IE 11 (with CSS custom property fallbacks)
1269
+
1270
+ ---
1271
+
1272
+ ## Resources
1273
+
1274
+ - **Design System:** Based on Saudi Arabia Platforms Code
1275
+ - **Primary Color:** Saudi Green (#25935f)
1276
+ - **Color Palettes:** 8 palettes × 12 shades = 96 colors
1277
+ - **Utility Classes:** 1000+ generated classes
1278
+
1279
+ ---
1280
+
1281
+ **Version:** 1.0.0
1282
+ **Last Updated:** December 2024
1283
+ **Maintained by:** DGA Design Team
1284
+ **License:** © 2024 DGA Design System. All rights reserved.