-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: ci | ||
|
||
on: [ push, pull_request ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: install deno | ||
uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: 1.X | ||
|
||
- name: check format | ||
run: deno fmt --check | ||
|
||
- name: check linting | ||
run: deno lint | ||
|
||
- name: run tests | ||
run: deno test |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.npm |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 mineejo | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Color convert | ||
|
||
Color convert is a set of conversion functions and automated conversions of | ||
color models and formats. | ||
|
||
### About | ||
|
||
Color convert does not rely on fragile practices, like converting ANSI16 to RGB. | ||
Why is this fragile? RGB is 16 million colors, converting to ANSI16 we get the | ||
code or ID of the color, not the color itself, so they are called system colors | ||
and are reserved by the system, changing depending on the runtime environment. | ||
|
||
- Quite a few conversions are planned for the future if anyone needs it. | ||
- All percentages are specified in the range `0` to `100`, this is more readable | ||
to the user. | ||
- `HSV` and `HSB` are the same thing, but separated due to the frequent use of | ||
both names. | ||
- `LAB` refers to `CIELAB` and `RGB` refers to `sRGB`, these are the most | ||
frequent variants of the models that have become the basis, so do not need | ||
direct name clarification. | ||
|
||
## Installation | ||
|
||
`CommonJS` (script directory) and `ModuleJS` (esm directory) support for | ||
`Node.js`, see [NPM page] for installation command. Also support for `Yarn` and | ||
other package managers or CDNs like `UNPKG`. For `Deno` reference see | ||
[module page], or use CDN like `esm.sh`. | ||
|
||
[NPM page]: https://www.npmjs.com/package/@chalkpot/color_convert | ||
[module page]: https://deno.land/x/chalkpot_color_convert | ||
|
||
## Usage | ||
|
||
```ts | ||
const green = rgbToAnsi16(0, 255, 0)[0]; | ||
console.log(green); // 10 | ||
console.log(wrapAnsi16(green)); // [92, 102] | ||
|
||
console.log(rgbToName(255, 0, 0)[0]); // red | ||
|
||
console.log(rgbToLab(255, 100, 25)); // [62.03..., 56.12..., 66.05...] | ||
``` | ||
|
||
## Contributing | ||
|
||
Pull requests are welcome. For major changes, please open an issue first to | ||
discuss what you would like to change. | ||
|
||
## License | ||
|
||
[MIT](https://choosealicense.com/licenses/mit/) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2023 mineejo. All rights reserved. MIT license. | ||
|
||
import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
const outDir = "./.npm"; | ||
|
||
await emptyDir(outDir); | ||
|
||
await build({ | ||
entryPoints: ["./mod.ts"], | ||
outDir: outDir, | ||
shims: { | ||
deno: true, | ||
}, | ||
test: true, | ||
package: { | ||
name: "@chalkpot/color_convert", | ||
version: Deno.args[0], | ||
description: | ||
"Color convert is a set of conversion functions and automated conversions of color models and formats.", | ||
author: "mineejo", | ||
license: "MIT", | ||
homepage: "https://github.com/chalkpot/color_convert#readme", | ||
repository: { | ||
type: "git", | ||
url: "git+https://github.com/chalkpot/color_convert.git", | ||
}, | ||
bugs: { | ||
url: "https://github.com/chalkpot/color_convert/issues", | ||
}, | ||
keywords: [ | ||
"chalkpot", | ||
"color", | ||
"convert", | ||
"color-convert", | ||
"ansi16", | ||
"ansi256", | ||
"cmy", | ||
"cmyk", | ||
"hex", | ||
"hsb", | ||
"hsl", | ||
"hsv", | ||
"lab", | ||
"name", | ||
"rgb", | ||
"xyz", | ||
], | ||
}, | ||
postBuild() { | ||
Deno.copyFileSync("LICENSE", `${outDir}/LICENSE`); | ||
Deno.copyFileSync("README.md", `${outDir}/README.md`); | ||
}, | ||
}); |