Vue-material: Unable to set Hue for background and accent in theme

Created on 16 Jan 2017  路  10Comments  路  Source: vuematerial/vue-material

I'm trying to create a dark theme and the code doesn't allow you to set a custom hue for background or accent:
http://codepen.io/anon/pen/KagLoJ

Hue is always overridden.

Below works for me, and I believe follows the intent. Set a default Hue value for accent and background but only if you haven't provided it with your theme:

diff --git a/src/core/components/mdTheme/index.js b/src/core/components/mdTheme/index.js
index fa8e2f9..c6c7ccd 100644
--- a/src/core/components/mdTheme/index.js
+++ b/src/core/components/mdTheme/index.js
@@ -62,9 +62,7 @@ const parseStyle = (style, theme) => {
       }

       if (colorType === 'COLOR') {
-        let isDefault = palette[theme[type]];
-
-        if (!hue && !isDefault) {
+        if (!theme[type] || !theme[type].hasOwnProperty('hue')) {
           if (type === 'accent') {
             colorVariant = 'A200';
           } else if (type === 'background') {
improvement

Most helpful comment

I will change that. The background is hardcoded. Sorry about that.

All 10 comments

I will change that. The background is hardcoded. Sorry about that.

Am I right that same problem exists if you try to overwrite the default theme?

Vue.material.registerTheme('default', { primary: 'indigo', accent: { color: 'indigo', hue: 700 }, warn: 'red', })

Accent applies indigo color, but not hue 700.

Yeah. It seems that it takes a lighter hue from the specified color
It would be nice if the background displayed the correct shade.

Same problem here, I just used my own CSS and added !important to the tags

+1

+1

+1

+1

+1

Closing this issue as our focus is on the new 1.0.0 version.

https://vuematerial.io/themes/configuration

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bryanspearman picture bryanspearman  路  3Comments

jtouzy picture jtouzy  路  3Comments

philipfeldmann picture philipfeldmann  路  3Comments

korylprince picture korylprince  路  3Comments

markus-s24 picture markus-s24  路  3Comments