Skip to content

Commit 3b9dfdd

Browse files
authored
Merge pull request #12937 from nucleogenesis/themeTokens-appBarText-for-is
AppBar: Use appBarText for text/icon colors
2 parents 44c8236 + d33c457 commit 3b9dfdd

File tree

7 files changed

+46
-13
lines changed

7 files changed

+46
-13
lines changed

kolibri/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#: This may not be the exact version as it's subject to modification with
1313
#: get_version() - use ``kolibri.__version__`` for the exact version string.
14-
VERSION = (0, 17, 4)
14+
VERSION = (0, 17, 5)
1515

1616
__author__ = "Learning Equality"
1717
__email__ = "[email protected]"

kolibri/core/assets/src/styles/themeConfig.js

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import Vue from 'vue';
22

33
const themeConfig = Vue.observable({
44
appBar: {
5+
background: null,
6+
textColor: null,
57
topLogo: {
68
src: null,
79
alt: null,

kolibri/core/assets/src/styles/themeSpec.js

+20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logger from 'kolibri.lib.logging';
2+
import { themeTokens } from 'kolibri-design-system/lib/styles/theme';
23
import isObject from 'lodash/isObject';
34

45
const logging = logger.getLogger(__filename);
@@ -42,6 +43,25 @@ const _imageSpec = {
4243
};
4344

4445
export default {
46+
appBar: {
47+
type: Object,
48+
default: null,
49+
spec: {
50+
background: {
51+
type: String,
52+
default: themeTokens().appBar,
53+
},
54+
textColor: {
55+
type: String,
56+
default: themeTokens().text,
57+
},
58+
topLogo: {
59+
type: Object,
60+
default: null,
61+
spec: _imageSpec,
62+
},
63+
},
64+
},
4565
brandColors: {
4666
type: Object,
4767
default: null,

kolibri/core/assets/src/views/AppBar.vue

+11-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22

33
<div
44
v-show="!$isPrint"
5-
:style="{ backgroundColor: $themeTokens.appBar }"
5+
:style="{
6+
backgroundColor: themeConfig.appBar.background,
7+
color: themeConfig.appBar.textColor,
8+
}"
69
>
710
<header>
811
<SkipNavigationLink />
912

1013
<UiToolbar
1114
:removeNavIcon="showAppNavView"
1215
type="clear"
13-
textColor="black"
16+
:textColor="themeConfig.appBar.textColor"
1417
class="app-bar"
15-
:style="{ height: topBarHeight + 'px' }"
18+
:style="{
19+
height: topBarHeight + 'px',
20+
color: themeConfig.appBar.textColor,
21+
}"
1622
:raised="false"
1723
:removeBrandDivider="true"
1824
>
@@ -26,7 +32,7 @@
2632
>
2733
<KIconButton
2834
icon="menu"
29-
:color="$themeTokens.text"
35+
:color="themeConfig.appBar.textColor"
3036
:ariaLabel="$tr('openNav')"
3137
@click="$emit('toggleSideNav')"
3238
/>
@@ -94,7 +100,7 @@
94100
<KIcon
95101
icon="person"
96102
:style="{
97-
fill: $themeTokens.text,
103+
fill: themeConfig.appBar.textColor,
98104
height: '24px',
99105
width: '24px',
100106
margin: '4px',

kolibri/core/assets/src/views/Navbar/NavbarLink.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
3030
import { validateLinkObject } from 'kolibri.utils.validators';
3131
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
32+
import themeConfig from 'kolibri.themeConfig';
3233
3334
/**
3435
Links for use inside the Navbar
@@ -38,6 +39,7 @@
3839
setup() {
3940
const { windowIsSmall } = useKResponsiveWindow();
4041
return {
42+
themeConfig,
4143
windowIsSmall,
4244
};
4345
},
@@ -61,7 +63,7 @@
6163
computed: {
6264
tabStyles() {
6365
return {
64-
color: this.$themeTokens.text,
66+
color: this.themeConfig.appBar.textColor,
6567
':hover': {
6668
'background-color': this.$themeBrand.secondary.v_600,
6769
},
@@ -81,7 +83,7 @@
8183
activeClasses() {
8284
// return both fixed and dynamic classes
8385
return `router-link-active ${this.$computedClass({
84-
color: this.$themeTokens.text,
86+
color: this.themeConfig.appBar.textColor,
8587
})}`;
8688
},
8789
},

kolibri/core/assets/src/views/Navbar/index.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
>
1717
<KIcon
1818
:icon="link.icon"
19-
:color="$themeTokens.text"
19+
:color="themeConfig.appBar.textColor"
2020
/>
2121
</NavbarLink>
2222
</ul>
@@ -27,7 +27,7 @@
2727
:ariaLabel="coreString('moreOptions')"
2828
icon="optionsHorizontal"
2929
appearance="flat-button"
30-
:color="$themeTokens.text"
30+
:color="themeConfig.appBar.textColor"
3131
:primary="false"
3232
class="kiconbutton-style"
3333
>
@@ -51,6 +51,7 @@
5151
import isUndefined from 'lodash/isUndefined';
5252
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
5353
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
54+
import themeConfig from 'kolibri.themeConfig';
5455
import NavbarLink from './NavbarLink';
5556
/**
5657
* Used for navigation between sub-pages of a top-level Kolibri section
@@ -67,6 +68,7 @@
6768
windowIsLarge,
6869
windowIsMedium,
6970
windowWidth,
71+
themeConfig,
7072
};
7173
},
7274
props: {

kolibri/core/assets/src/views/SideNav.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -196,22 +196,23 @@
196196
height: topBarHeight + 'px',
197197
width: `${width}`,
198198
paddingTop: windowIsSmall ? '4px' : '8px',
199-
backgroundColor: $themeTokens.appBar,
199+
backgroundColor: themeConfig.appBar.background,
200+
color: themeConfig.appBar.textColor,
200201
}"
201202
>
202203
<KIconButton
203204
ref="closeButton"
204205
tabindex="0"
205206
icon="close"
206-
:color="$themeTokens.text"
207+
:color="themeConfig.appBar.textColor"
207208
class="side-nav-header-icon"
208209
:ariaLabel="$tr('closeNav')"
209210
size="large"
210211
@click="toggleNav"
211212
/>
212213
<span
213214
class="side-nav-header-name"
214-
:style="{ color: $themeTokens.text }"
215+
:style="{ color: themeConfig.appBar.textColor }"
215216
>{{ sideNavTitleText }}</span>
216217
</div>
217218
</FocusTrap>

0 commit comments

Comments
 (0)