Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
v1.4.1 (#6)
Browse files Browse the repository at this point in the history
### Added

- Implemented `Palette.Nearest` method, which returns the nearest colour in a
  palette to a given colour.
- Implemented `LAB.Lerp` method, which returns a colour between two colours in
  the LAB colour space.
- Missing TypeScript types for new methods and `Hex.fromHexRGBA`.
- CI workflow to ensure code is formatted and linted correctly.

### Fixed

- Due to a typo, the `APCA.GetContrastRatio` method was throwing an error when
  attempting to calculate the contrast ratio for certain colours.

### Changed

All deprecated methods will output warnings to the console when used for the
first time. This is to help users migrate to the new methods.

- This project's toolchain is now managed by aftman. Use of foreman is not recommended.
- All instances of the word "colour" have been changed to "color" to match the
  US spelling and keep consistency with the Roblox API.
- `ColorUtils.Emphasise` and `ColorUtils.GetContrastingColour` are now marked as
  deprecated for the same reason as above.
- `ColorUtils.GetContrastingColor` is now marked as deprecated. The `WCAG`
  submodule should be used instead, since both `APCA` and `WCAG` provide two
  different methods for calculating contrast ratio.
- `ColorUtils.GetContrastRatio` is now marked as deprecated and implements a
  compatibility layer. Previously this was a redirect to `WCAG.GetContrastRatio`
  but now it will use `APCA.GetContrastRatio` because it is more accurate. `WCAG`
  values (`0-21`) will be returned for backwards compatibility until the method is
  removed in a future release.
- `Palette.Tailwind` will now produce a darker 950 shade, in line with
  [Tailwind v3.3.2](https://tailwindcss.com/docs/customizing-colors). Note that the
  generated palette will be slightly different to tailwind's, since the algorithm
  used to generate the palette is different.
  • Loading branch information
cxmeel authored Jul 10, 2023
1 parent b932ad8 commit ee905c6
Show file tree
Hide file tree
Showing 115 changed files with 1,043 additions and 665 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
push:
branches: [main]

jobs:
build:
name: Test and Build
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v2

- name: Setup Aftman
uses: ok-nick/[email protected]

- name: Install Packages
run: wally install

- name: Build
run: rojo build default.project.json -o test.rbxm

- name: Set Environment Variables
run: |
echo "COMMIT_HASH=$(git rev-parse --short ${{github.sha}})" >> $GITHUB_ENV
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: ${{github.event.repository.name}}-${{env.COMMIT_HASH}}.rbxm
path: test.rbxm

lint:
name: Format and Lint
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v2

- name: Setup Aftman
uses: ok-nick/[email protected]

- name: Format
run: stylua --check src/

- name: Lint
run: selene src/
36 changes: 4 additions & 32 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Publish Package

env:
ASSET_ID_STABLE: 6573728888

on:
workflow_dispatch:
release:
Expand All @@ -14,39 +11,19 @@ jobs:
timeout-minutes: 8

steps:
- name: Checkout Repository
uses: actions/checkout@v2

# - name: Test Roblox Login Tokens
# shell: bash
# run: |
# if [ -z "${{ secrets.ROBLOSECURITY }}" ]; then
# echo "No cookie found. Please set the ROBLOSECURITY secret."
# exit 1
# fi

# RBX_USERNAME=$(curl -s -X GET -H "Cookie: .ROBLOSECURITY=${{ secrets.ROBLOSECURITY }}" https://users.roblox.com/v1/users/authenticated | jq -r ".name")

# if [ -z "$RBX_USERNAME" ]; then
# echo "ROBLOSECURITY is invalid or expired. Please reset the ROBLOSECURITY secret."
# exit 1
# fi

# echo "Logged in as $RBX_USERNAME."
- uses: actions/checkout@v2

- name: Setup Node LTS
uses: actions/setup-node@v2
with:
node-version: lts/*

- name: Setup Toolchain
uses: Roblox/setup-foreman@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Aftman
uses: ok-nick/[email protected]

- name: Report Tool Versions
run: |
foreman list
aftman list
npm -v
node -v
Expand All @@ -59,11 +36,6 @@ jobs:
run: |
find . -name "*.spec.lua" -delete
# - name: Publish to Roblox
# if: ${{ github.event.release.prerelease == false }}
# shell: bash
# run: rojo upload default.project.json --asset_id $ASSET_ID_STABLE --cookie "${{ secrets.ROBLOSECURITY }}"

- name: Publish to Wally
if: ${{ github.event.release.prerelease == false }}
env:
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ name: Create GitHub Release

on:
workflow_dispatch:
branches:
- default

jobs:
create-release:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Ensure Wally+NPM Version Numbers Match
run: |
Expand All @@ -33,14 +30,11 @@ jobs:
exit 1
fi
- name: Setup Toolchain
uses: Roblox/setup-foreman@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: "^1.0.1"
- name: Setup Aftman
uses: ok-nick/[email protected]

- name: Report Tool Versions
run: foreman list
run: aftman list

- name: Get Release Details
shell: bash
Expand All @@ -55,12 +49,17 @@ jobs:
run: wally install

- name: Remove Tests
run: |
find . -name "*.spec.lua" -delete
run: find . -name "*.spec.lua" -delete

- name: Build Project
run: rojo build default.project.json -o $RELEASE_FILENAME

- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.RELEASE_FILENAME }}
path: ${{ env.RELEASE_FILENAME }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.rbx*
sourcemap.json

roblox.toml
testez.toml

node_modules/
*.tsbuildinfo
Expand Down
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

stylua --check src/
selene src/
3 changes: 3 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"MD033": false
}
Binary file added .moonwave/static/media/tailwind-palette.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sort_requires]
enabled = true
10 changes: 0 additions & 10 deletions .vscode/extensions.json

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/scripts/run-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$FILE_NAME = "test-place"

foreman install
aftman install
rojo build .\test.project.json -o ".\$FILE_NAME.rbxl"
run-in-roblox --place ".\$FILE_NAME.rbxl" --script ".\test-runner.server.lua"
Remove-Item -Force ".\$FILE_NAME.rbxl"
11 changes: 5 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"robloxLsp.diagnostics.severity": {
"unused-local": "Error",
"unused-function": "Error",
"unused-vararg": "Error",
"duplicate-index": "Error"
}
"[lua]": {
"editor.defaultFormatter": "JohnnyMorganz.stylua",
"editor.formatOnSave": true
},
"debug.toolBarLocation": "hidden"
}
77 changes: 64 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
# Changelog

## [1.4.1]

### Added

- Implemented `Palette.Nearest` method, which returns the nearest colour in a
palette to a given colour.
- Implemented `LAB.Lerp` method, which returns a colour between two colours in
the LAB colour space.
- Missing TypeScript types for new methods and `Hex.fromHexRGBA`.
- CI workflow to ensure code is formatted and linted correctly.

### Fixed

- Due to a typo, the `APCA.GetContrastRatio` method was throwing an error when
attempting to calculate the contrast ratio for certain colours.

### Changed

All deprecated methods will output warnings to the console when used for the
first time. This is to help users migrate to the new methods.

- This project's toolchain is now managed by aftman. Use of foreman is not recommended.
- All instances of the word "colour" have been changed to "color" to match the
US spelling and keep consistency with the Roblox API.
- `ColorUtils.Emphasise` and `ColorUtils.GetContrastingColour` are now marked as
deprecated for the same reason as above.
- `ColorUtils.GetContrastingColor` is now marked as deprecated. The `WCAG`
submodule should be used instead, since both `APCA` and `WCAG` provide two
different methods for calculating contrast ratio.
- `ColorUtils.GetContrastRatio` is now marked as deprecated and implements a
compatibility layer. Previously this was a redirect to `WCAG.GetContrastRatio`
but now it will use `APCA.GetContrastRatio` because it is more accurate. `WCAG`
values (`0-21`) will be returned for backwards compatibility until the method is
removed in a future release.
- `Palette.Tailwind` will now produce a darker 950 shade, in line with
[Tailwind v3.3.2](https://tailwindcss.com/docs/customizing-colors). Note that the
generated palette will be slightly different to tailwind's, since the algorithm
used to generate the palette is different.

## [1.3.1]

- Implemented transparency blending:
- This returns a new Color3 that acts as if it was overlaid on a background color with a given alpha.
- Added `Hex.fromHexRGBA`, which converts a hex string with an alpha channel to a Color3.
- This returns a new Color3 that acts as if it was overlaid on a background
color with a given alpha.
- Added `Hex.fromHexRGBA`, which converts a hex string with an alpha channel to
a Color3.

## [1.3.0]

Expand All @@ -15,28 +56,36 @@
- `LAB` (`.fromLAB, .toLAB`) _(:test_tube: experimental)_.
- `LCH` (`.fromLCH, .toLCH`) _(:test_tube: experimental)_.
- Saturation methods to either saturate or desaturate a colour.
- Tailwind CSS-style palette generator - Generates 10 swatches, given a base colour, and returns a `TailwindPalette` object (see the docs for more details).
- Tailwind CSS-style palette generator - Generates 10 swatches, given a base
colour, and returns a `TailwindPalette` object (see the docs for more details).

### Changed

- Updated the docs for Hex and Int. The converter methods were previously documented in PascalCase, but they should have been documented in camelCase.
- The `Palette.Monochromatic` method now accepts an optional second parameter, `swatches`, which defaults to `3`. This is to allow for more control over the number of swatches generated.
- **:warning: Warning:** The behaviour of monochromatic has been changed to allow for more control over the number of swatches generated.
- The new behaviour will return `X` amount of swatches, **including** the base colour. The results do not necessarily include a single lighter and darker swatch, and the resulting array is now sorted from darkest to lightest (most vibrant).

###
- Updated the docs for Hex and Int. The converter methods were previously
documented in PascalCase, but they should have been documented in camelCase.
- The `Palette.Monochromatic` method now accepts an optional second parameter,
`swatches`, which defaults to `3`. This is to allow for more control over the
number of swatches generated.
- **:warning: Warning:** The behaviour of monochromatic has been changed to
allow for more control over the number of swatches generated.
- The new behaviour will return `X` amount of swatches, **including** the base
colour. The results do not necessarily include a single lighter and darker
swatch, and the resulting array is now sorted from darkest to lightest (most
vibrant).

## [1.2.0]

### Added

- `WCAG` submodule to house the current `.GetContrastRatio` and `.GetContrastingColour` methods.
- `WCAG` submodule to house the current `.GetContrastRatio` and `.GetContrastingColour`
methods.
- `APCA` submodule, which contains an updated version of `.GetContrastRatio`.
- Implemented colour blindness simulation under the `Blind` submodule.
- Supports the Trichroma-, Protan-, Deutan-, Tritan- and Achroma- groups.
- Includes friendly "`Enums`" for non-scientists.
- Documentation site using [moonwave](https://upliftgames.github.io/moonwave/).
- TypeScript alias for `.GetContrastingColour` in root namespace (previously only Luau).
- TypeScript alias for `.GetContrastingColour` in root namespace (previously only
Luau).

### Changed

Expand All @@ -45,13 +94,15 @@

### Removed

- Removed `rotriever.toml` to drop support for kayak and other rotriever-based package managers.
- Removed `rotriever.toml` to drop support for kayak and other rotriever-based
package managers.

## [1.1.1]

### Added

- Added `.GetContrastingColour` to adjust a forground colour to meet the minimum contrast ratio against a background colour.
- Added `.GetContrastingColour` to adjust a forground colour to meet the minimum
contrast ratio against a background colour.

## [1.1.0]

Expand Down
Loading

0 comments on commit ee905c6

Please sign in to comment.