Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from color-js:main #15

Merged
merged 37 commits into from
Feb 1, 2025
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3e20e82
Use `fetch()` instead of `readFileSync()` so it works client-side too
LeaVerou Oct 2, 2024
ea1b406
Make `space.js` work both in Node.js and client-side (#600)
DmitrySharabin Oct 4, 2024
a078a42
Avoid style recalculation of all elements on each scroll event (#592)
Inwerpsel Oct 10, 2024
6738c99
Fix return type for deltas function
lloydk Oct 1, 2024
b91ce6e
Remove spaceId from the return type
lloydk Oct 9, 2024
ee0ed30
Create v0.6.0 changelog draft
LeaVerou Oct 24, 2024
f31f98d
Rename v0.6.0 to v0.6.0.md
LeaVerou Oct 24, 2024
07281ad
Avoid mutating objects in Color constructor (#603)
MysteryBlokHed Oct 24, 2024
5f7d7f4
Update v0.6.0.md
svgeesus Oct 24, 2024
b6984aa
Update v0.6.0.md
MysteryBlokHed Oct 25, 2024
5c1536e
Replace `instanceof` checks to work across color.js sources (#605)
MysteryBlokHed Nov 3, 2024
1acd41f
[build] Build color-fn with ESM exports (#606)
MysteryBlokHed Nov 4, 2024
c81c4ea
[oklch] Rename `Oklch` → `OKLCh` (#608)
DmitrySharabin Nov 13, 2024
78dead5
Update the v0.6.0 release notes (#607)
DmitrySharabin Nov 17, 2024
84efd2b
[oklch] Rename `OKLCh` → `OkLCh `
DmitrySharabin Nov 27, 2024
153e262
Update number of installs
LeaVerou Nov 29, 2024
2e9dd5c
Update README.md
LeaVerou Nov 30, 2024
7bc6ff9
Fix parsing 7 character hex colors successfully (#616)
kleinfreund Dec 23, 2024
f1b9193
Update htest.dev to 0.0.15
lloydk Dec 23, 2024
c2178fe
Add funding link to npm package (#618)
MysteryBlokHed Dec 25, 2024
daf657d
Fix failing parse metadata test
lloydk Dec 25, 2024
eb268f9
Update htest to 0.0.16
lloydk Dec 25, 2024
47804df
Update release notes (#621)
DmitrySharabin Dec 25, 2024
a3e8958
[spaces/xyz-d65] Add ref ranges to relative XYZ color spaces (#620)
DmitrySharabin Dec 25, 2024
713e72c
Fix parsing coords that have a minimum range < 0 (#619)
lloydk Dec 26, 2024
3f75ca4
npm update
LeaVerou Dec 26, 2024
68a9449
Update v0.6.0.md
LeaVerou Dec 26, 2024
2978b1d
Release 0.6.0-alpha.1
LeaVerou Dec 26, 2024
adf3d96
Update spaces.d2
LeaVerou Dec 26, 2024
3a96e39
Add links to other Color.js initiatives to README
LeaVerou Dec 26, 2024
148af07
2 fixes for type="custom" ColorSpaces (#628)
sidewayss Jan 3, 2025
168b96b
Fix cam16 and hct type errors (#622)
lloydk Jan 4, 2025
db0479d
Cleanup hsluv tests
lloydk Jan 5, 2025
ffa9c3f
[tests] Add more matrix multiply tests (#594)
epsilonError Jan 11, 2025
db3e23b
[ci] Add workflow to auto-update download count in README (#610)
MysteryBlokHed Jan 31, 2025
09fe3f3
[style] Use Prettier (#626)
MysteryBlokHed Jan 31, 2025
8c80efc
Update README download count
github-actions[bot] Feb 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[ci] Add workflow to auto-update download count in README (color-js#610)
* [ci] Add workflow to auto-update downloads

This workflow runs a bash script to pull the latest download count from
npm, and update the README.md number if the new value is larger.

* [ci] Round download count number

* [ci] Tweak download count script

Makes the regex match look for the exact same string as sed does.
Probably won't actually matter, but doesn't hurt to do.
  • Loading branch information
MysteryBlokHed authored Jan 31, 2025
commit db3e23b0aa389f02e46969f3a12f8ef6f355ba4e
47 changes: 47 additions & 0 deletions .github/workflows/download_count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Update Download Count

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
update-downloads:
name: Update Download Count
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Get download count
run: |
# check downloads
downloads=$(curl https://api.npmjs.org/downloads/point/1970-01-01:$(date -d '+1 day' +"%Y-%m-%d")/colorjs.io | jq -r .downloads)
echo "Latest download count: $downloads"
# into millions
downloads=$(( (downloads + 500000) / 1000000 ))
# try to find current download count in readme
readme=$(<README.md)
if [[ "$readme" =~ '['([0-9]+)' million total npm downloads]' ]]; then
current_downloads="${BASH_REMATCH[1]}"
# if the new count is bigger, update it
if [[ "$downloads" -gt "$current_downloads" ]]; then
echo "New count ($downloads million) is greater than current $current_downloads million, updating..."
readme=$(echo "$readme" | sed -E "s/\[[0-9]+ million total npm downloads\]/[$downloads million total npm downloads]/")
echo "$readme" > README.md
else
echo "New count ($downloads million) is less than or equal to current $current_downloads million; not doing anything."
fi
fi
echo Done!

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1
with:
commit_message: Update README download count
file_pattern: README.md
# default github-actions user info as commit author
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>