1 |
efrain |
1 |
---
|
|
|
2 |
layout: docs
|
|
|
3 |
title: "Colours"
|
|
|
4 |
date: 2020-02-04T09:40:32+01:00
|
|
|
5 |
draft: false
|
|
|
6 |
weight: 1
|
|
|
7 |
---
|
|
|
8 |
|
|
|
9 |
## The Moodle colour scheme:
|
|
|
10 |
|
|
|
11 |
Moodle colours are slighty different from standard Bootstrap colours. Custom moodle colours are usually defined in a theme preset. For example `theme/boost/scss/preset/default.scss`
|
|
|
12 |
|
|
|
13 |
{{< example show_markup=false >}}
|
|
|
14 |
<div class="card-deck">
|
|
|
15 |
{{< colors.inline >}}
|
|
|
16 |
{{- range (index $.Site.Data "colors") }}
|
|
|
17 |
<div class="card mb-2 justify-content-center align-items-center d-flex" style="flex: 0 0 20%; height: 150px">
|
|
|
18 |
<div class="card-body bg-{{ .name }} w-100" style="height: 100px">
|
|
|
19 |
</div>
|
|
|
20 |
<div class="card-footer w-100">
|
|
|
21 |
<span>{{ .name }}</span>
|
|
|
22 |
</div>
|
|
|
23 |
</div>
|
|
|
24 |
{{- end -}}
|
|
|
25 |
{{< /colors.inline >}}
|
|
|
26 |
</div>
|
|
|
27 |
{{< /example >}}
|
|
|
28 |
|
|
|
29 |
## The standard Bootstrap colour scheme:
|
|
|
30 |
|
|
|
31 |
{{< example show_markup=false >}}
|
|
|
32 |
<div class="card-deck">
|
|
|
33 |
{{< colors.inline >}}
|
|
|
34 |
{{- range (index $.Site.Data "colors") }}
|
|
|
35 |
<div class="card mb-2 justify-content-center align-items-center d-flex" style="flex: 0 0 20%; height: 150px">
|
|
|
36 |
<div class="card-body w-100" style="height: 100px; background-color: {{ .hex }}">
|
|
|
37 |
</div>
|
|
|
38 |
<div class="card-footer w-100">
|
|
|
39 |
<span>{{ .name }}</span>
|
|
|
40 |
</div>
|
|
|
41 |
</div>
|
|
|
42 |
{{- end -}}
|
|
|
43 |
{{< /colors.inline >}}
|
|
|
44 |
</div>
|
|
|
45 |
{{< /example >}}
|
|
|
46 |
|
|
|
47 |
These colours are used throughout Moodle in text, buttons
|
|
|
48 |
|
|
|
49 |
{{< example show_markup=false >}}
|
|
|
50 |
<p>
|
|
|
51 |
<span class="badge badge-success">Badges</span>
|
|
|
52 |
</p>
|
|
|
53 |
<p>
|
|
|
54 |
<button class="btn btn-success">Buttons</button>
|
|
|
55 |
</p>
|
|
|
56 |
<p>
|
|
|
57 |
<div class="border border-success">Borders</div>
|
|
|
58 |
</p>
|
|
|
59 |
|
|
|
60 |
{{< /example >}}
|
|
|
61 |
|
|
|
62 |
## Customizing moodle colours
|
|
|
63 |
|
|
|
64 |
Use the $theme-colours Scss array to customize colours in theme/boost/scss/preset/default.scss.
|
|
|
65 |
|
|
|
66 |
{{< highlight scss >}}
|
|
|
67 |
$theme-colors: map-merge((
|
|
|
68 |
primary: #1177d1,
|
|
|
69 |
secondary: #ced4da,
|
|
|
70 |
success: #398439,
|
|
|
71 |
info: #5bc0de,
|
|
|
72 |
warning: #f0ad4e,
|
|
|
73 |
danger: #d43f3a,
|
|
|
74 |
light: #f8f9fa,
|
|
|
75 |
dark: #373a3c
|
|
|
76 |
), $theme-colors);
|
|
|
77 |
{{< /highlight >}}
|