themes updated
This commit is contained in:
1 parent
5d738c71a7
commit
bbdabf5610
12 files changed
+216
-62
No files matched your search
@@ -4,9 +4,45 @@ export default function (app) {
|
||||
app.component('accessibilityControl', {
|
||||
template,
|
||||
controller: ($scope, theme) => {
|
||||
|
||||
$scope.scopes = {
|
||||
color: [
|
||||
['bw', 'белым по черному'],
|
||||
['wb', 'черным по белому'],
|
||||
],
|
||||
|
||||
fontSize: [
|
||||
['normal', 'нормальный'],
|
||||
['big', 'большой'],
|
||||
['biggest', 'огромный'],
|
||||
],
|
||||
|
||||
fontFamily: [
|
||||
['sans', 'без засечек'],
|
||||
['serif', 'с засечками'],
|
||||
],
|
||||
|
||||
image: [
|
||||
['yesImg', 'отображаются'],
|
||||
['noImg', 'спрятаны'],
|
||||
],
|
||||
|
||||
kerning: [
|
||||
['normal', 'обычный'],
|
||||
['big', 'увеличенный'],
|
||||
],
|
||||
}
|
||||
|
||||
$scope.isActive = (scope, [name,]) => theme.isActive(scope, name)
|
||||
|
||||
$scope.setDefaultTheme = () => theme.toggle()
|
||||
$scope.setDefaultSettings = () => theme.setDefaultAccessibilityTheme()
|
||||
|
||||
$scope.setColorTheme = theme.setColorTheme.bind(theme)
|
||||
$scope.setFontTheme = theme.setFontTheme.bind(theme)
|
||||
$scope.setFontFamilyTheme = theme.setFontFamilyTheme.bind(theme)
|
||||
$scope.setImageTheme = theme.setImageTheme.bind(theme)
|
||||
$scope.setKerningTheme = theme.setKerningTheme.bind(theme)
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -14,10 +14,20 @@ const themeScheme = {
|
||||
},
|
||||
|
||||
fontSize: {
|
||||
normal: 'theme-accessibility-font-normal',
|
||||
normal: '',
|
||||
big: 'theme-accessibility-font-big',
|
||||
biggest: 'theme-accessibility-font-biggest',
|
||||
},
|
||||
|
||||
image: {
|
||||
yesImg: '',
|
||||
noImg: 'theme-accessibility-no-image',
|
||||
},
|
||||
|
||||
kerning: {
|
||||
normal: '',
|
||||
big: 'theme-accessibility-kerning-big',
|
||||
},
|
||||
}
|
||||
|
||||
const defaultAccessibilityTheme = () => ({
|
||||
@@ -26,7 +36,9 @@ const defaultAccessibilityTheme = () => ({
|
||||
accessibility: 'accessibility',
|
||||
color: 'wb',
|
||||
font: 'sans',
|
||||
fontSize: 'big',
|
||||
fontSize: 'normal',
|
||||
image: 'yesImg',
|
||||
kerning: 'normal',
|
||||
},
|
||||
})
|
||||
|
||||
@@ -121,13 +133,36 @@ class Theme {
|
||||
this.install()
|
||||
}
|
||||
|
||||
setImageTheme(theme) {
|
||||
this.themeSetup.theme.image = theme
|
||||
this.install()
|
||||
}
|
||||
|
||||
setKerningTheme(theme) {
|
||||
this.themeSetup.theme.kerning = theme
|
||||
this.install()
|
||||
}
|
||||
|
||||
install() {
|
||||
this.setTheme(this.themeSetup)
|
||||
}
|
||||
|
||||
isDefaultTheme(){
|
||||
const theme = loadTheme()
|
||||
return !theme // default theme cleared up local storage
|
||||
isDefaultTheme() {
|
||||
return this.__scope.theme === this.mainTheme
|
||||
}
|
||||
|
||||
isActive(scope, name) {
|
||||
if (this.isDefaultTheme()) return false
|
||||
|
||||
try {
|
||||
return this.themeSetup.theme[scope] === name
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
setDefaultAccessibilityTheme () {
|
||||
this.setTheme(defaultAccessibilityTheme())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user