Skip to content

diameter in % vh or even dvh #41

@Forsskieken

Description

@Forsskieken

Hi there,

I'm running into trouble with my card that I can't set the diameter in % vh or dvh. If only it would accept a var value....

In my code I'm trying to scale the clock depending on a device it's shown.
Like deskop, Nest, Pixel7

The AI's let me run in circles

type: custom:mod-card
view_layout:
  grid-area: main
style:
  .: >
    ha-card {
      width: var(--clock-size);
      height: var(--clock-size);
      border-radius: 16px;
      padding: 0;
      margin: 0 auto;
      box-sizing: border-box;
      overflow: hidden;
      height: 100%;
      width: 100%;
      /* Responsive max dimensions */
     /* max-width: 100%;*/
      /*max-height: 100%;*/
    } canvas {
      width: 100% !important;
      height: 100% !important;
    } @media (min-width: 1024px) {
      ha-card {
        max-width: 800px;
        max-height: 500px;
        **--clock-size: 500px;**
      }
    }

    @media (min-width: 900px) and (max-height: 650px) and (orientation:
    landscape) {
      ha-card {
        max-width: 700px;
        max-height: 400px;
        **--clock-size: 440px;**
      }
    }

    @media (max-width: 950px) and (max-height: 500px) and (orientation:
    landscape) {
      ha-card {
        max-width: 500px;
        max-height: 240px;
        **--clock-size: 250px;**
      }
    }

    @media (max-width: 600px) and (orientation: portrait) {
      ha-card {
        max-width: 350px;
        max-height: 250px;
      }
    }
card:
  type: custom:state-switch
  entity: input_select.button_nest
  default: Clock
  states:
    Voordeur:
      type: custom:webrtc-camera
      url: Hoofdingang_sub
      mode: webrtc
      media: video
    Poortje:
      type: custom:webrtc-camera
      url: Poortje
      mode: webrtc
      media: video
    Wachtkamer:
      type: custom:webrtc-camera
      url: rtsp://admin:[email protected]:554/h264Preview_01_main
      mode: webrtc
      media: video
    Clock:
      type: custom:analog-clock
      hide_secondHand: false
      locale: sv-SE
      diameter: 100%
      color_hourhand: "#326ba8"
      color_minutehand: "#3273a8"
      color_secondhand: "#e74c3c"
      color_digitaltime: "#CCCCCC"
      color_facedigits: "#a83832"
      color_ticks: Silver
      dateformat: mmm dd yyyy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions