Last active
July 30, 2020 19:02
-
-
Save ASH-Bryan/231e29997d3dbfd059ac12c96e974b7b to your computer and use it in GitHub Desktop.
Color themes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from '@ember/component'; | |
import layout from '../templates/components/my-component'; | |
import colorContract from '../mixins/color-contract'; | |
export default Component.extend(colorContract, { | |
layout, | |
classNameBindings: ['mainContrastBackground'], | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Mixin from '@ember/object/mixin'; | |
import { computed } from '@ember/object'; | |
export default Mixin.create({ | |
colorTheme: '', | |
utilPrefix: computed('colorTheme', function() { | |
return this.colorTheme ? 'p' : 'd'; | |
}), | |
/* MAIN */ | |
mainColor: computed('utilPrefix', function() { | |
return `${this.utilPrefix}-main-color`; | |
}), | |
mainBackground: computed('utilPrefix', function() { | |
return `${this.utilPrefix}-main-background`; | |
}), | |
mainFill: computed('utilPrefix', function() { | |
return `${this.utilPrefix}-main-fill`; | |
}), | |
/* MAINCONTRAST */ | |
mainContrastColor: computed('utilPrefix', function() { | |
return `${this.utilPrefix}-contrast-color`; | |
}), | |
mainContrastBackground: computed('utilPrefix', function() { | |
return `${this.utilPrefix}-contrast-background`; | |
}), | |
mainContrastFill: computed('utilPrefix', function() { | |
return `${this.utilPrefix}-contrast-fill`; | |
}), | |
/* ACTION */ | |
actionColor: computed('utilPrefix', function() { | |
return `${this.utilPrefix}-action-color`; | |
}), | |
actionBackground: computed('utilPrefix', function() { | |
return `${this.utilPrefix}-action-background`; | |
}), | |
actionFill: computed('utilPrefix', function() { | |
return `${this.utilPrefix}-action-fill`; | |
}) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
/* UTILITY CLASSES PREFIX APPROACH */ | |
/* Default theme */ | |
.d-main-color { | |
color: red; | |
} | |
.d-main-background { | |
background-color: red; | |
} | |
.d-contrast-color { | |
color: lightgray; | |
} | |
.d-contrast-background { | |
background-color: lightgray; | |
} | |
/* Primary theme */ | |
.p-main-color { | |
color: blue; | |
} | |
.p-main-background { | |
background-color: blue; | |
} | |
.p-contrast-color { | |
color: lightyellow; | |
} | |
.p-contrast-background { | |
background-color: lightyellow; | |
} | |
/* CONTAINER APPROACH */ | |
/* Default theme */ | |
.defaultTheme .text-color { | |
color: red; | |
} | |
.defaultTheme .bg-color { | |
background-color: lightgray; | |
} | |
/* Primary theme */ | |
.primaryTheme .text-color { | |
color: blue; | |
} | |
.primaryTheme .bg-color { | |
background-color: lightyellow; | |
} | |
/* Support */ | |
.themeContainer { | |
border: 2px solid black; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.17.1", | |
"EmberENV": { | |
"FEATURES": {}, | |
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false, | |
"_APPLICATION_TEMPLATE_WRAPPER": true, | |
"_JQUERY_INTEGRATION": true | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js", | |
"ember": "3.8.3", | |
"ember-template-compiler": "3.8.3", | |
"ember-testing": "3.8.3" | |
}, | |
"addons": { | |
"@glimmer/component": "1.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment