{"id":18751158,"url":"https://github.com/substrate-system/blur-hash","last_synced_at":"2025-06-18T10:36:54.506Z","repository":{"id":248087993,"uuid":"827578182","full_name":"substrate-system/blur-hash","owner":"substrate-system","description":"Image component with a blurry placeholder","archived":false,"fork":false,"pushed_at":"2025-03-26T05:05:47.000Z","size":84,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T00:08:03.216Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://substrate-system.github.io/blur-hash/","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/substrate-system.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2024-07-12T00:00:11.000Z","updated_at":"2025-03-26T05:05:45.000Z","dependencies_parsed_at":"2024-07-12T10:07:36.089Z","dependency_job_id":"05bbc4d2-7b04-4588-9bc9-489546f52549","html_url":"https://github.com/substrate-system/blur-hash","commit_stats":null,"previous_names":["substrate-system/blur-hash"],"tags_count":2,"template":false,"template_full_name":"substrate-system/template-web-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fblur-hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fblur-hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fblur-hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fblur-hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/substrate-system","download_url":"https://codeload.github.com/substrate-system/blur-hash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647299,"owners_count":21139086,"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":[],"created_at":"2024-11-07T17:14:41.699Z","updated_at":"2025-04-13T00:08:07.768Z","avatar_url":"https://github.com/substrate-system.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# blur hash\n![tests](https://github.com/substrate-system/icons/actions/workflows/nodejs.yml/badge.svg)\n[![types](https://img.shields.io/npm/types/@substrate-system/icons?style=flat-square)](README.md)\n[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)\n[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver\u0026style=flat-square)](https://semver.org/)\n[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n\nThis is the [\"blur-up\" image loading technique](https://css-tricks.com/the-blur-up-technique-for-loading-background-images/), with the [blur-hash algorithm](https://blurha.sh/), as a [web component](https://developer.mozilla.org/en-US/docs/Web/API/Web_components).\n\n[See a live demonstration](https://substrate-system.github.io/blur-hash/)\n\n\u003e [!TIP]\n\u003e Throttle the internet speed with the dev tools.\n\n\u003c!-- toc --\u003e\n\n- [install](#install)\n- [API](#api)\n  * [ESM](#esm)\n  * [Common JS](#common-js)\n  * [attributes](#attributes)\n- [CSS](#css)\n  * [Import CSS](#import-css)\n  * [variables](#variables)\n- [use](#use)\n  * [Bundler](#bundler)\n  * [pre-built JS](#pre-built-js)\n- [Create the string](#create-the-string)\n  * [Print to system clipboard](#print-to-system-clipboard)\n\n\u003c!-- tocstop --\u003e\n\n## install\n\n```sh\nnpm i -S @substrate-system/blur-hash\n```\n\n## API\n\nThis exposes ESM and common JS via [package.json `exports` field](https://nodejs.org/api/packages.html#exports).\n\n### ESM\n```js\nimport '@substrate-system/blur-hash'\n```\n\n### Common JS\n```js\nrequire('@substrate-system/blur-hash')\n```\n\n### attributes\nTakes the following attributes\n\n#### time\nThe time for css transitions and animation. This is set as a CSS variable.\n\n#### placeholder\nThe string created by the blurhash algorithm. See [node example](#create-the-string).\n\n#### width \u0026 height\nThe dimensions for the image\n\n## CSS\n\n### Import CSS\n\n```js\nimport '@substrate-system/blur-hash/css'\n```\n\nOr minified:\n```js\nimport '@substrate-system/blur-hash/css/min'\n```\n\n### variables\n\n__CSS variables__\n\n* `--blur-hash-time` -- the transition time for animating blurry -\u003e sharp,\n  default is `0.8s`\n* `--blur-hash-opactiy` -- the opacity to use for the placeholder image,\n  default is `0.6`\n\n## use\nThis calls the global function `customElements.define`. Just import, then use\nthe tag in your HTML.\n\n### Bundler\n\n#### JS\n```js\nimport '@substrate-system/blur-hash'\n```\n\n#### HTML\n```html\n\u003cdiv\u003e\n    \u003cblur-hash\n        time=\"0.6s\"\n        placeholder=\"LEHV6nWB2yk8pyo0adR*.7kCMdnj\"\n        src=\"...\"\n        width=100\n        height=100\n    \u003e\n    \u003c/blur-hash\u003e\n\u003c/div\u003e\n```\n\n### pre-built JS\nThis package exposes minified JS files too. Copy them to a location that is\naccessible to your web server, then link to them in HTML.\n\n#### copy\n```sh\ncp ./node_modules/@substrate-system/blur-hash/dist/blur-hash.min.js ./public\n```\n\n#### HTML\n```html\n\u003cscript type=\"module\" src=\"./blur-hash.min.js\"\u003e\u003c/script\u003e\n```\n\n## Create the string\nThis package includes a CLI tool to create the placeholder string. After installing this as a dependency,\n\n```sh\nnpx blur ./my-file.jpg\n```\n\nWill print a string to stdout that can be used as a placeholder attribute.\n\n### Print to system clipboard\nOn mac os,\n\n```sh\nnpx blur ./my-file.jpg | pbcopy\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstrate-system%2Fblur-hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubstrate-system%2Fblur-hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstrate-system%2Fblur-hash/lists"}