{"id":13588578,"url":"https://github.com/thomasloven/lovelace-card-mod","last_synced_at":"2026-01-29T01:28:08.228Z","repository":{"id":38848289,"uuid":"190927524","full_name":"thomasloven/lovelace-card-mod","owner":"thomasloven","description":"🔹 Add CSS styles to (almost) any lovelace card","archived":false,"fork":false,"pushed_at":"2025-01-06T22:34:35.000Z","size":834,"stargazers_count":1358,"open_issues_count":94,"forks_count":178,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-05-28T16:30:52.813Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasloven.png","metadata":{"files":{"readme":"README-developers.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-08T19:34:17.000Z","updated_at":"2025-05-28T12:42:47.000Z","dependencies_parsed_at":"2023-02-12T01:00:21.415Z","dependency_job_id":"f115e144-b8f2-4058-9d76-ad404d02c2e4","html_url":"https://github.com/thomasloven/lovelace-card-mod","commit_stats":{"total_commits":161,"total_committers":15,"mean_commits":"10.733333333333333","dds":"0.11180124223602483","last_synced_commit":"f59abc785eabb689ac42a9076197254421f96c60"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/thomasloven/lovelace-card-mod","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasloven%2Flovelace-card-mod","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasloven%2Flovelace-card-mod/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasloven%2Flovelace-card-mod/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasloven%2Flovelace-card-mod/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasloven","download_url":"https://codeload.github.com/thomasloven/lovelace-card-mod/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasloven%2Flovelace-card-mod/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278268948,"owners_count":25959101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:06:47.971Z","updated_at":"2025-10-04T05:37:09.509Z","avatar_url":"https://github.com/thomasloven.png","language":"TypeScript","funding_links":[],"categories":["Install from Source","TypeScript","Dashboards"],"sub_categories":["Smart Home Automation","Custom Cards"],"readme":"You can apply card mod styling to things you made by:\n\n```js\ncustomElements.whenDefined(\"card-mod\").then((cardMod) =\u003e {\n  cardMod.applyToElement(\n    el, // The root element\n    \"type\", // Determines which theme variables should apply (card-mod-\u003ctype\u003e, card-mod-\u003ctype\u003e-yaml)\n    config, // The card mod configuration. See below\n    variables, // Any variables passed on to jinja templates, preferably { config: \u003celement configuration\u003e }. Default: {}\n    shadow // whether the styles should be based in the #shadow-root of el. Default: true\n    cls // An extra class to apply to the element. Default: undefined\n  )\n}\n```\n\nThe card mod configuration is an objecty with the following optional properties:\n\n- `style` - card mod style definition (string or object)\n- `class` - string or array of classes to apply to the element\n- `debug` - boolean to enable debugging mode for the element (default `false`)\n\n## Example\n\n```js\nclass CardModdingCard extends HTMLElement {\n  setConfig(config) {\n    this._config = config;\n  }\n\n  connectedCallback() {\n    const div = document.createElement(\"div\");\n    this.appendChild(div);\n    div.innerHTML = `\n    \u003ch1\u003e This is a custom card\u003c/h1\u003e\n    It doesn't have a \u003cb\u003eha-card\u003c/b\u003e element, but it will still use any styles for cards from the card-mod configuration or theme.\n    `;\n\n    customElements\n      .whenDefined(\"card-mod\")\n      .then((cardMod) =\u003e\n        cardMod.applyToElement(\n          div,\n          \"card\",\n          this._config.card_mod,\n          { config: this._config },\n          false,\n          \"type-custom-card-modding-card\"\n        )\n      );\n  }\n}\n\ncustomElements.define(\"card-modding-card\", CardModdingCard);\n```\n\nWith the following dashboard configuration:\n\n```yaml\ntype: custom:card-modding-card\ncard_mod:\n  style: |\n    h1 {color: blue;}\n```\n\nAnd this theme:\n\n```yaml\ntest:\n  card-mod-theme: test\n  card-mod-card-yaml: |\n    .: |\n      b {\n        color: red;\n      }\n```\n\nWe get this:\n![bild](https://github.com/thomasloven/lovelace-card-mod/assets/1299821/d1c01db4-50cc-40b6-aeb7-eac8dd173112)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasloven%2Flovelace-card-mod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasloven%2Flovelace-card-mod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasloven%2Flovelace-card-mod/lists"}