Skip to content

Commit c580dd1

Browse files
authored
Merge pull request #37 from lehni/feature/deactivate-color-styling
Allow deactivation of automatic color styling
2 parents 2206c5d + b1c0879 commit c580dd1

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ Use:
4141
| sync | Boolean | false | If set to `true`, will be watching changes in `value` property and overwrite the current state of the button whenever `value` prop. changes |
4242
| speed | Number | 300 | Transition time for the animation |
4343
| disabled | Boolean | false | Button does not react on mouse events |
44-
| color | [String, Object] | `#75C791` | if `String` - color of the button when checked <br>If `Object` - colors for the button when checked/uncheked <br>Example: `{checked: '#00FF00', unchecked: '#FF0000'}` |
44+
| color | [String, Object] | `#75C791` | If `String` - color of the button when checked <br>If `Object` - colors for the button when checked/uncheked <br>Example: `{checked: '#00FF00', unchecked: '#FF0000'}` |
45+
| cssColors | Boolean | false | If `true` - deactivates the setting of colors through inline styles in favor of using CSS styling |
4546
| labels | [Boolean, Object] | false | If `Boolean` - shows/hides default labels ("on" and "off") <br>If `Object` - sets custom labels for both states. <br>Example: `{checked: 'Foo', unchecked: 'Bar'}` |
4647
| width | Number | 50 | Width of the button, default is 50 |
4748
| height | Number | 22 | Height of the button, default is 22 |

dist/index.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ssr.index.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Button.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
const constants = {
2828
colorChecked: '#75C791',
2929
colorUnchecked: '#bfcbd9',
30+
cssColors: false,
3031
labelChecked: 'on',
3132
labelUnchecked: 'off',
3233
width: 50,
@@ -67,6 +68,10 @@ export default {
6768
: typeof value === 'string'
6869
}
6970
},
71+
cssColors: {
72+
type: Boolean,
73+
default: false
74+
},
7075
labels: {
7176
type: [Boolean, Object],
7277
default: false,
@@ -100,7 +105,7 @@ export default {
100105
return {
101106
width: px(this.width),
102107
height: px(this.height),
103-
backgroundColor: this.colorCurrent,
108+
backgroundColor: this.cssColors ? null : this.colorCurrent,
104109
borderRadius: px(Math.round(this.height / 2))
105110
}
106111
},

0 commit comments

Comments
 (0)