Skip to content

Make it possible to change font size on text labels#50

Open
Techwolf12 wants to merge 2 commits intocustom-cards:masterfrom
Techwolf12:patch-1
Open

Make it possible to change font size on text labels#50
Techwolf12 wants to merge 2 commits intocustom-cards:masterfrom
Techwolf12:patch-1

Conversation

@Techwolf12
Copy link
Copy Markdown

Pull request for: #45 (Thanks @M4v3r1cK87 for this code!)
It would be really nice to have!

@Ulrar
Copy link
Copy Markdown

Ulrar commented Feb 26, 2022

Any chance to get this merged?

Comment thread dual-gauge-card.js
Comment on lines +279 to +280
--outer-font-size: var(--outer-font-size);
--inner-font-size: var(--inner-font-size);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sets those variables to themselves, which doesn't do much.

Instead the default value should be set here and should be relative to --gauge-card-width, like the other font sizes.

Suggested change
--outer-font-size: var(--outer-font-size);
--inner-font-size: var(--inner-font-size);
--outer-font-size: calc(var(--gauge-card-width) / 15);
--inner-font-size: calc(var(--gauge-card-width) / 15);

Comment thread dual-gauge-card.js
Comment on lines +27 to +36

if (!this.config.fontsize) {
this.config.fontsize = 20;
}
if (!this.config.outer.fontsize) {
this.config.outer.fontsize = this.config.fontsize;
}
if (!this.config.inner.fontsize) {
this.config.inner.fontsize = this.config.fontsize;
}
Copy link
Copy Markdown
Collaborator

@Rocka84 Rocka84 Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default values for css-variables should be set via css. See my other suggestion.
What should happen here is to use the global value for the inner and/or outer gauge, if available and no individual values are set.

Suggested change
if (!this.config.fontsize) {
this.config.fontsize = 20;
}
if (!this.config.outer.fontsize) {
this.config.outer.fontsize = this.config.fontsize;
}
if (!this.config.inner.fontsize) {
this.config.inner.fontsize = this.config.fontsize;
}
if (this.config.fontsize && !this.config.outer.fontsize) {
this.config.outer.fontsize = this.config.fontsize;
}
if (this.config.fontsize && !this.config.inner.fontsize) {
this.config.inner.fontsize = this.config.fontsize;
}

@lazzaroevan
Copy link
Copy Markdown

can this be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants