diff --git a/src/components/panels/Extruder/ExtruderControlPanelTools.vue b/src/components/panels/Extruder/ExtruderControlPanelTools.vue
index 0d675ee0..e5d395e6 100644
--- a/src/components/panels/Extruder/ExtruderControlPanelTools.vue
+++ b/src/components/panels/Extruder/ExtruderControlPanelTools.vue
@@ -1,7 +1,13 @@
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/src/components/panels/Extruder/ExtruderControlPanelToolsItem.vue b/src/components/panels/Extruder/ExtruderControlPanelToolsItem.vue
index 937b7ae8..707a2cd6 100644
--- a/src/components/panels/Extruder/ExtruderControlPanelToolsItem.vue
+++ b/src/components/panels/Extruder/ExtruderControlPanelToolsItem.vue
@@ -1,11 +1,11 @@
+
{{ macro.name }}
@@ -27,19 +27,62 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin
}
get color() {
- return this.macro.variables.color ?? this.macro.variables.colour ?? null
+ const color = this.macro.variables.color ?? this.macro.variables.colour ?? null
+ if (color === '' || color === 'undefined') return null
+
+ return color
}
- get buttonClass() {
- return {
- 'primary--text': this.active,
+ get primaryColor(): string {
+ return this.$store.state.gui.uiSettings.primary
+ }
+
+ get primaryTextColor(): string {
+ let splits = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(this.primaryColor)
+ if (splits) {
+ const r = parseInt(splits[1], 16) * 0.2126
+ const g = parseInt(splits[2], 16) * 0.7152
+ const b = parseInt(splits[3], 16) * 0.0722
+ const perceivedLightness = (r + g + b) / 255
+
+ return perceivedLightness > 0.7 ? '#222' : '#fff'
}
+
+ return '#ffffff'
+ }
+
+ get warningColor(): string {
+ return this.$vuetify?.theme?.currentTheme?.warning?.toString() ?? '#ff8300'
}
get buttonStyle() {
+ let backgroundColor = ''
+ if (this.active) {
+ backgroundColor = this.homedAxes.includes('xyz') ? this.primaryColor : this.warningColor
+ }
+
+ const textColor = this.active ? this.primaryTextColor : ''
+
return {
+ color: textColor,
+ 'background-color': backgroundColor,
+ }
+ }
+
+ get dotStyle() {
+ return {
+ 'border-color': this.active ? this.primaryTextColor : '',
'background-color': '#' + this.color,
}
}
}
+
+