{"id":16760399,"url":"https://github.com/ryanve/varam","last_synced_at":"2026-02-12T15:02:55.247Z","repository":{"id":48377454,"uuid":"389400333","full_name":"ryanve/varam","owner":"ryanve","description":"change CSS var via URL param with this 77 line library called varam","archived":false,"fork":false,"pushed_at":"2021-07-29T05:19:16.000Z","size":23,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T21:51:24.007Z","etag":null,"topics":["css","cssvar","frontend","javascript","params","technique","urlsearchparams"],"latest_commit_sha":null,"homepage":"https://ryanve.dev/varam","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanve.png","metadata":{"files":{"readme":"README.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}},"created_at":"2021-07-25T17:08:02.000Z","updated_at":"2023-08-08T21:02:43.000Z","dependencies_parsed_at":"2022-09-01T17:53:06.448Z","dependency_job_id":null,"html_url":"https://github.com/ryanve/varam","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":"s9a/zero","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fvaram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fvaram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fvaram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fvaram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanve","download_url":"https://codeload.github.com/ryanve/varam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847056,"owners_count":20357317,"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","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":["css","cssvar","frontend","javascript","params","technique","urlsearchparams"],"created_at":"2024-10-13T04:23:23.400Z","updated_at":"2026-02-12T15:02:50.226Z","avatar_url":"https://github.com/ryanve.png","language":"JavaScript","readme":"# varam\n\n[🟣 **online**](https://ryanve.dev/varam) [**latest**](../../releases/latest)\n\n## change CSS var via URL param\n\n### mention desired param\n\nplace `data-varam` on any scope to represent CSS `var`\n\n```html\n\u003csamp data-varam=\"oil ink\"\u003e\n```\n\n- only scoped mentions will change\n- scope page via root\n\n\n```html\n\u003chtml data-varam=\"oil ink\"\u003e\n```\n\n- combine data with URL params to update matching `var`\n- combining `?oil=olive\u0026ink=black` would style each `var`\n\n```css\n--oil: olive;\n--ink: black;\n```\n\n### var your style\n\n```css\nbackground: var(--oil);\ncolor: var(--ink);\n```\n\n### code sensible default style\n\n```css\nfont-size: var(--size, 1em);\nwriting-mode: var(--mode, horizontal-tb);\n```\n\n### code hyperlinks with `\u0026amp;`\n\n```html\n?oil=orange\u0026amp;ink=black\n```\n\n## [javascript](varam.js)\n\n### automagic\n\n🚥 `varam` automagically runs when you load [varam.js](varam.js)\n\n```html\n\u003cscript async src=\"varam.js\"\u003e\u003c/script\u003e\n```\n\n- URL params are read and only read\n- CSS var are updated where matching\n- [async or defer to your desire](../../releases)\n\n### updating\n\n- performant updating\n- we minimize reflow\n- [just load the script](#automagic) to go with the flow with real URL\n- [updaters](#updaters) return [boolean](#boolean) whether reflow expected\n- update if you change dom (otherwise no need)\n\n### updaters\n\n- `varam.flow()` automagic does `varam(location.search)` with real URL\n- `varam.reset()` to reset state like `varam(\"\")`  but leave URL alone\n- `varam.fresh(...)` is how varam performantly interacts with style\n\n### boolean\n\n- `true` when update was made\n- `false` when update needless\n\n### help\n\n`varam.help()` for help in your console\n\n### diagnostic\n\n- `varam.meta` content interpreted\n- `varam.state` latest state\n- `varam.via` paramethod `\"flow\"` or `\"meta\"`\n\n### [staging](../../pull/8)\n\n- default checks `location.search` **not meta**\n- staging meta simulates alternate search\n- **omit meta** unless you're staging\n\n```html\n\u003cmeta name=\"varam\" content=\"oil=purple\"\u003e\n```\n\n## technology\n\n- [`URLSearchParams`](https://mdn.io/URLSearchParams)\n- [`location`](https://mdn.io/window-location)\n- [`script`](https://mdn.io/the-script-element)\n- [`style`](https://mdn.io/CSSStyleDeclaration)\n- [`html`](index.html) [`data-`](https://mdn.io/data-attributes)\n- [`css`](www.css) [`var`](https://mdn.io/css-var)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fvaram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanve%2Fvaram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fvaram/lists"}