Clean up theme settings (#5395)

This commit is contained in:
Bram Kragten 2020-04-01 17:26:38 +02:00 committed by GitHub
parent dfe808cfb4
commit d5ed1c4c41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 28 additions and 27 deletions

View File

@ -82,7 +82,6 @@ export class HuiButtonCard extends LitElement implements LovelaceCard {
} }
this._config = { this._config = {
theme: "default",
hold_action: { action: "more-info" }, hold_action: { action: "more-info" },
double_tap_action: { action: "none" }, double_tap_action: { action: "none" },
show_icon: true, show_icon: true,

View File

@ -93,7 +93,7 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard {
public setConfig(config: EntitiesCardConfig): void { public setConfig(config: EntitiesCardConfig): void {
const entities = processConfigEntities(config.entities); const entities = processConfigEntities(config.entities);
this._config = { theme: "default", ...config }; this._config = config;
this._configEntities = entities; this._configEntities = entities;
if (config.show_header_toggle === undefined) { if (config.show_header_toggle === undefined) {
// Default value is show toggle if we can at least toggle 2 entities. // Default value is show toggle if we can at least toggle 2 entities.

View File

@ -82,7 +82,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
if (!isValidEntityId(config.entity)) { if (!isValidEntityId(config.entity)) {
throw new Error("Invalid Entity"); throw new Error("Invalid Entity");
} }
this._config = { min: 0, max: 100, theme: "default", ...config }; this._config = { min: 0, max: 100, ...config };
} }
public connectedCallback(): void { public connectedCallback(): void {

View File

@ -74,7 +74,7 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
} }
public setConfig(config: GlanceCardConfig): void { public setConfig(config: GlanceCardConfig): void {
this._config = { theme: "default", state_color: true, ...config }; this._config = { state_color: true, ...config };
const entities = processConfigEntities<GlanceConfigEntity>(config.entities); const entities = processConfigEntities<GlanceConfigEntity>(config.entities);
for (const entity of entities) { for (const entity of entities) {

View File

@ -70,7 +70,7 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
throw new Error("Entities need to be an array"); throw new Error("Entities need to be an array");
} }
this._config = { theme: "default", ...config }; this._config = config;
this._configEntities = config.entities this._configEntities = config.entities
? processConfigEntities(config.entities) ? processConfigEntities(config.entities)
: []; : [];

View File

@ -78,7 +78,6 @@ export class HuiLightCard extends LitElement implements LovelaceCard {
} }
this._config = { this._config = {
theme: "default",
...config, ...config,
tap_action: { action: "toggle" }, tap_action: { action: "toggle" },
}; };

View File

@ -212,7 +212,7 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
throw new Error("Specify an entity from within the media_player domain."); throw new Error("Specify an entity from within the media_player domain.");
} }
this._config = { theme: "default", ...config }; this._config = config;
} }
public connectedCallback(): void { public connectedCallback(): void {

View File

@ -217,7 +217,6 @@ class HuiSensorCard extends LitElement implements LovelaceCard {
const cardConfig = { const cardConfig = {
detail: 1, detail: 1,
theme: "default",
hours_to_show: 24, hours_to_show: 24,
...config, ...config,
}; };

View File

@ -87,7 +87,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
throw new Error("Specify an entity from within the climate domain."); throw new Error("Specify an entity from within the climate domain.");
} }
this._config = { theme: "default", ...config }; this._config = config;
} }
public connectedCallback(): void { public connectedCallback(): void {

View File

@ -56,7 +56,7 @@ export class HuiAlarmPanelCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -84,7 +84,7 @@ export class HuiButtonCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "default"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -63,7 +63,7 @@ export class HuiEntitiesCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -65,7 +65,7 @@ export class HuiEntityCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "default"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {
@ -136,7 +136,7 @@ export class HuiEntityCardEditor extends LitElement
.hass=${this.hass} .hass=${this.hass}
.value=${this._theme} .value=${this._theme}
.configValue=${"theme"} .configValue=${"theme"}
@theme-changed=${this._valueChanged} @value-changed=${this._valueChanged}
></hui-theme-select-editor> ></hui-theme-select-editor>
</div> </div>
`; `;

View File

@ -57,7 +57,7 @@ export class HuiGaugeCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "default"; return this._config!.theme || "";
} }
get _min(): number { get _min(): number {

View File

@ -60,7 +60,7 @@ export class HuiGlanceCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
get _columns(): number { get _columns(): number {

View File

@ -52,7 +52,7 @@ export class HuiLightCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "default"; return this._config!.theme || "";
} }
get _entity(): string { get _entity(): string {

View File

@ -46,7 +46,7 @@ export class HuiMarkdownCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -56,7 +56,7 @@ export class HuiPictureCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -96,7 +96,7 @@ export class HuiPictureEntityCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -107,7 +107,7 @@ export class HuiPictureGlanceCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -47,7 +47,7 @@ export class HuiPlantStatusCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -70,7 +70,7 @@ export class HuiSensorCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "default"; return this._config!.theme || "";
} }
get _hours_to_show(): number | string { get _hours_to_show(): number | string {

View File

@ -42,7 +42,7 @@ export class HuiShoppingListEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -46,7 +46,7 @@ export class HuiThermostatCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "default"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -45,7 +45,7 @@ export class HuiWeatherForecastCardEditor extends LitElement
} }
get _theme(): string { get _theme(): string {
return this._config!.theme || "Backend-selected"; return this._config!.theme || "";
} }
protected render(): TemplateResult { protected render(): TemplateResult {

View File

@ -117,7 +117,11 @@ export class HUIView extends LitElement {
padding: 4px 4px 0; padding: 4px 4px 0;
transform: translateZ(0); transform: translateZ(0);
position: relative; position: relative;
background: var(--lovelace-background); color: var(--primary-text-color);
background: var(
--lovelace-background,
var(--primary-background-color)
);
} }
#badges { #badges {