forked from joeblew99/gu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
style_template.go
executable file
·728 lines (564 loc) · 14.6 KB
/
style_template.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
// Package style is generated to contain the content of a css template for generating a styleguide for use in projects.
// Document is auto-generate and should not be modified by hand.
//go:generate go run generate.go
package styleguide
// styleTemplate contains the text template used to generated the full set of
// css template for a giving styleguide.
var styleTemplate = `
html {
font-size: {{ .BaseFontSize }}px;
font-family: "Noto", "Roboto", Helvetica, sans-serif, serif;
}
/*
____________ Base classes ____________________________
Base classes for the styleguide project.
*/
.wrap {
text-wrap: wrap;
white-space: -moz-pre-wrap;
white-space: pre-wrap;
word-wrap: break-word;
}
.sizing {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-o-box-sizing: border-box;
-moz-box-sizing: border-box;
}
.clear {
content: " ";
clear: both;
display: block;
visibility: hidden;
height: 0;
font-size: 0;
}
.item-center {
display: flex;
flex-direction: row;
align-self:center;
}
.content-center {
display: flex;
flex-direction: row;
justify-content: center;
align-self:center;
align-items: center;
}
h1, h2, h3, h4, h5, h6, p {
margin: 0;
padding: 0;
}
a, a:hover, a:active, a:visited{
color: #000;
text-decoration: none;
}
/*
____________ Line height classes ____________________________
Line height defines giving sets of the first capital length hight
suggestable for styles
In typography, cap height refers to the height of a capital letter above the baseline for a particular typeface.
print = 1.25em, Desktop(Large, Normal) = 1.3756, Tablet(Large) = 1.3756, Phone = 1.25
*/
.line-height-print, .line-height-phone {
line-height: 1.25;
}
.line-height-deskop, .line-height-desktop-large {
line-height: 1.3756;
}
.line-height-tablet {
line-height: 1.3756;
}
/*
____________ Cap height classes ____________________________
Cap height defines giving sets of the first capital length hight
suggestable for styles
In typography, cap height refers to the height of a capital letter above the baseline for a particular typeface.
small = 0.8, medium = 0.8, large = 0.68, extra-large = 0.68
*/
/*
____________ Line height classes ____________________________
Letter spacing class go from highest to lowest where the highest is in positive
spacing value and the last in negative spacing values.
*/
.letter-spacing-1 {
letter-spacing: 1px;
}
.letter-spacing-2 {
letter-spacing: -0.5px;
}
.letter-spacing-3 {
letter-spacing: -1px;
}
.letter-spacing-4 {
letter-spacing: -2px;
}
/*
____________ Base border radius classes ____________________________
These are classes for different border radius effect chosen specifically for
use with different components.
.smallRadius: For basic border radius for small elements eg radio, checkboxes.
.mediumRadius: For components like text, input, labels.
.largeRadius: For components like cards, modal boxes, etc
*/
.border-radius-sm {
-moz-border-radius: {{ .SmallBorderRadius }}px;
-webkit-border-radius: {{ .SmallBorderRadius }}px;
-o-border-radius: {{ .SmallBorderRadius }}px;
border-radius: {{ .SmallBorderRadius }}px;
}
.border-radius-md {
-moz-border-radius: {{ .MediumBorderRadius }}px;
-webkit-border-radius: {{ .MediumBorderRadius }}px;
-o-border-radius: {{ .MediumBorderRadius }}px;
border-radius: {{ .MediumBorderRadius }}px;
}
.border-radius-lg {
-moz-border-radius: {{ .LargeBorderRadius }}px;
-webkit-border-radius: {{ .LargeBorderRadius }}px;
-o-border-radius: {{ .LargeBorderRadius }}px;
border-radius: {{ .LargeBorderRadius }}px;
}
.border-radius-cirle {
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
}
/*
____________ Base shadowdrop classes ____________________________
These are classes for different shadow effect chosen specifically for
use with different components.
.shadow: For basic shadows for normal elements.
.shadow__drop: For shadow effects for dropdown/popovers type elements.
.shadow__hover: For shadow effects for hovers.
.shadow__elevanted: For shadow effects for elevated modals, cards, etc
shadow-key-umbra-opacity: 0.2 !default;
shadow-key-penumbra-opacity: 0.14 !default;
shadow-ambient-shadow-opacity: 0.12 !default;
*/
.focus-shadow {
box-shadow: 0 0 8px rgba(0,0,0,.18),0 8px 16px rgba(0,0,0,.36);
}
.shadow-2dp {
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
0 3px 1px -2px rgba(0, 0, 0, 0.2),
0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.shadow-3dp {
box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.14),
0 3px 3px -2px rgba(0, 0, 0, 0.2),
0 1px 8px 0 rgba(0, 0, 0, 0.12);
}
.shadow-4dp {
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14),
0 1px 10px 0 rgba(0, 0, 0, 0.12),
0 2px 4px -1px rgba(0, 0, 0, 0.2);
}
.shadow-6dp {
box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14),
0 1px 18px 0 rgba(0, 0, 0, 0.12),
0 3px 5px -1px rgba(0, 0, 0, 0.2);
}
.shadow-8dp {
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
0 3px 14px 2px rgba(0, 0, 0, 0.12),
0 5px 5px -3px rgba(0, 0, 0, 0.2);
}
.shadow-16dp {
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14),
0 6px 30px 5px rgba(0, 0, 0, 0.12),
0 8px 10px -5px rgba(0, 0, 0, 0.2);
}
.shadow-24dp {
box-shadow: 0 9px 46px 8px rgba(0, 0, 0, 0.14),
0 11px 15px -7px rgba(0, 0, 0, 0.12),
0 24px 38px 3px rgba(0, 0, 0, 0.2);
}
.shadow {
box-shadow: {{ .BaseShadow }};
}
.shadow-dropdown {
box-shadow: {{ .DropShadow }};
}
.shadow-hover {
box-shadow: {{ .HoverShadow }};
}
.shadow-elevated {
box-shadow: {{ .FloatingShadow }};
}
/* Google's material pallete color sets */
{{ range $key, $set := .MaterialPalettes }}
{{ range $index, $color := $set }}
{{ $count := multiply $index 100}}
.colors-background-{{$key}}-{{ add $count 100 }} {
background: rgba({{ $color}}, 1);
}
.colors-border-{{$key}}-{{ add $count 100 }} {
border-color: rgba({{ $color}}, 1);
}
.colors-color-{{$key}}-{{ add $count 100 }} {
color: rgba({{ $color}}, 1);
}
{{ end }}
{{ end }}
/*
____________ Base font size classes ____________________________
These are classes provide a simple set of font-scale font-size
which allow you to use for scaling based on an initial font-size
set on a parent, they should scale well.
font-size-sm: Defines font size for reducing sizes
font-size-bg: Defines font size for increasing sizes using a scale eg MajorThirds.
*/
{{ range $key, $item := .SmallHeaderScale }}
.small-heading-{{add $key 1}}{{if greaterThanEqual $key 0 }}, h{{add $key 7}} {{end}}{
font-size: {{$item}}em;
}
{{ end }}
{{ range $key, $item := .BigHeaderScale }}
.big-heading-{{add $key 1}}{{if lessThan $key 6 }}, h{{subtract 6 $key}} {{end}}{
font-size: {{$item}}em;
}
{{ end }}
{{ range $key, $item := .SmallFontScale }}
.small-font-{{ add $key 1 }} {
font-size: {{$item}}em;
}
{{ end }}
{{ range $key, $item := .BigFontScale }}
.big-font-{{ add $key 1 }} {
font-size: {{$item}}em;
}
{{ end }}
/*
____________ Font scale set ____________________________
Taken: http://typecast.com/blog/a-more-modern-scale-for-web-typography
*/
.body-desktop {
font-size: 16px;
font-size: 1em;
line-height: 1.375em;
}
.body-desktop-lg {
font-size: 16px;
font-size: 1em;
line-height: 1.25em;
}
.body-tablet-lg {
font-size: 16px;
font-size: 1em;
line-height: 1.375em;
}
.body-tablet-sm {
font-size: 16px;
font-size: 1em;
line-height: 1.25em;
}
.body-phone {
font-size: 16px;
font-size: 1em;
line-height: 1.25em;
}
.title-font {
font-size: 20px;
font-weight: 500;
line-height: 1;
letter-spacing: 0.02em;
}
.title-font-contrast {
opacity: 0.87;
}
.subheadline-font {
font-size: 16px;
font-weight: 400;
line-height: 24px;
letter-spacing: 0.04em;
}
.subheadline-font-contrast {
opacity: 0.87;
}
.subheadline2-font {
font-size: 16px;
font-weight: 400;
line-height: 28px;
letter-spacing: 0.04em;
}
.subheadline2-font-contrast {
opacity: 0.87;
}
.body-font {
font-size: 14px;
line-height: 24px;
letter-spacing: 0;
font-weight: 500;
}
.body-font-contrast {
opacity: 0.87;
}
.body1-font {
font-size: 14px;
font-weight: 400;
line-height: 24px;
letter-spacing: 0;
}
.body1-font-contrast {
opacity: 0.87;
}
.headline-font {
font-size: 24px;
font-weight: 400;
line-height: 32px;
-moz-osx-font-smoothing: grayscale;
}
.headline-font-contrast {
opacity: 0.87;
}
.caption-font {
font-size: 12px;
font-weight: 400;
line-height: 1;
letter-spacing: 0;
}
.caption-font-contrast {
opacity: 0.54;
}
.caption-font-contrast {
opacity: 0.54;
}
.blockquote-font {
position: relative;
font-size: 24px;
font-weight: 300;
font-style: italic;
line-height: 1.35;
letter-spacing: 0.08em;
}
.blockquote-font-contrast {
opacity: 0.54;
}
.blockquote-font:before, .blockquote-font-contrast:before {
position: absolute;
left: -0.5em;
content: '“';
}
.blockquote-font:after, .blockquote-font-contrast:after {
content: '”';
margin-left: -0.05em;
}
.menu-font {
font-size: 14px;
font-weight: 500;
line-height: 1;
letter-spacing: 0;
}
.menu-font-with-contrast {
font-size: 14px;
font-weight: 500;
line-height: 1;
letter-spacing: 0;
opacity: 0.87;
}
.button-font {
font-size: 14px;
font-weight: 500;
text-transform: uppercase;
line-height: 1;
letter-spacing: 0;
}
.button-font-with-contrast {
font-size: 14px;
font-weight: 500;
text-transform: uppercase;
line-height: 1;
letter-spacing: 0;
opacity: 0.87;
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
word-wrap: normal;
font-feature-settings: 'liga';
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}
/*
____________ Color set ____________________________
These are classes provide a color set based on specific brand colors
provided, these allows us to easily generate color, background and border-color
classes suited to provide a consistent color design for use in project.
These brand colors are divided into:
primary: Main color for the giving project's brand
secondary: Secondary brand color for project.
success: Color for successful operation or messages.
failure: Color for failed operations or messages.
These are further subdivided into these diffent tones/shades:
base: The original color without any modification.
Other color tones are graded from 10...nth where n is a multiple of 10 * index.
The lowest grade of 10 is where the color is close to it's darkest version while
the highest means a continous increase in luminousity.
We further generate classes for Color, Border-Color and Background based on the division and
subdivision.
*/
.brand-color-primary {
color: {{.Brand.PrimaryBrand.Base}};
}
.brand-border-color-primary {
border-color: {{.Brand.PrimaryBrand.Base}};
}
.brand-background-color-primary {
background: {{.Brand.PrimaryBrand.Base}};
}
{{ range $index, $item := .Brand.PrimaryBrand.Grades }}
{{ $rn := add $index 1 }}
.brand-background-color-primary-{{ multiply $rn 10}} {
background: {{$item}};
}
.brand-border-color-primary-{{ multiply $rn 10}} {
border-color: {{$item}};
}
.brand-primary-{{ multiply $rn 10}} {
color: {{$item}};
}
{{ end }}
.color-primary {
color: {{.Brand.Primary.Base}};
}
.border-color-primary {
border-color: {{.Brand.Primary.Base}};
}
.background-color-primary {
background: {{.Brand.Primary.Base}};
}
{{ range $index, $item := .Brand.Primary.Grades }}
{{ $rn := add $index 1 }}
.background-color-primary-{{ multiply $rn 10}} {
background: {{$item}};
}
.color-primary-{{ multiply $rn 10}} {
color: {{$item}};
}
.border-color-primary-{{ multiply $rn 10}} {
border-color: {{$item}};
}
{{ end }}
/*____________ Secondary color set ____________________________
*/
.color-secondary {
color: {{.Brand.Secondary.Base}};
}
.background-color-secondary {
background: {{.Brand.Secondary.Base}};
}
.border-color-secondary {
background: {{.Brand.Secondary.Base}};
}
{{ range $index, $item := .Brand.Secondary.Grades }}
{{ $rn := add $index 1 }}
.background-color-secondary-{{ multiply $rn 10}} {
background: {{$item}};
}
.border-color-secondary-{{ multiply $rn 10}} {
border-color: {{$item}};
}
.color-secondary-{{ multiply $rn 10}} {
color: {{$item}};
}
{{ end }}
.brand-color-secondary {
color: {{.Brand.SecondaryBrand.Base}};
}
.brand-background-color-secondary {
background: {{.Brand.SecondaryBrand.Base}};
}
.brand-border-color-secondary {
background: {{.Brand.SecondaryBrand.Base}};
}
{{ range $index, $item := .Brand.SecondaryBrand.Grades }}
{{ $rn := add $index 1 }}
.brand-background-color-secondary-{{ multiply $rn 10}} {
background: {{$item}};
}
.brand-border-color-secondary-{{ multiply $rn 10}} {
border-color: {{$item}};
}
.brand-color-secondary-{{ multiply $rn 10}} {
color: {{$item}};
}
{{ end }}
/*____________ Success color set ____________________________
*/
.brand-success {
color: {{.Brand.Success.Base}};
}
.background-color-success {
background: {{.Brand.Success.Base}};
}
.border-color-success {
border-color: {{.Brand.Success.Base}};
}
{{ range $index, $item := .Brand.Success.Grades }}
{{ $rn := add $index 1 }}
.background-color-success-{{ multiply $rn 10}} {
background: {{$item}};
}
.brand-success-{{ multiply $rn 10}} {
color: {{$item}};
}
.border-color-success-{{ multiply $rn 10}} {
border-color: {{$item}};
}
{{ end }}
/*____________ White color set ____________________________
*/
.background-color-white {
background: {{.Brand.White.Base}};
}
.brand-white {
color: {{.Brand.White.Base}};
}
.border-color-white {
border-color: {{.Brand.White.Base}};
}
{{ range $index, $item := .Brand.White.Grades }}
{{ $rn := add $index 1 }}
.background-color-white-{{ multiply $rn 10}} {
background: {{$item}};
}
.brand-white-{{ multiply $rn 10}} {
color: {{$item}};
}
.border-color-white-{{ multiply $rn 10}} {
border-color: {{$item}};
}
{{ end }}
/*____________ Failure color set ____________________________
*/
.background-color-failure {
background: {{.Brand.Failure.Base}};
}
.brand-failure {
color: {{.Brand.Failure.Base}};
}
.border-color-failure {
border-color: {{.Brand.Failure.Base}};
}
{{ range $index, $item := .Brand.Failure.Grades }}
{{ $rn := add $index 1 }}
.background-color-failure-{{ multiply $rn 10}} {
background: {{$item}};
}
.brand-failure-{{ multiply $rn 10}} {
color: {{$item}};
}
.border-color-failure-{{ multiply $rn 10}} {
border-color: {{$item}};
}
{{ end }}
/*______________________________________________________________________
*/`