Skip to content

Commit 5f07a5a

Browse files
authored
Merge pull request #3 from waterbeside/dev
Dev
2 parents 1cdbfdf + 203a139 commit 5f07a5a

File tree

18 files changed

+1043
-107
lines changed

18 files changed

+1043
-107
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# [1.1.0](https://github.com/waterbeside/colorsea/compare/v1.0.1...v1.1.0) (2023-02-03)
2+
3+
### Features
4+
5+
* Brightness method and visibility method , Check the visibility of one color over another. ([12bca3f](https://github.com/waterbeside/colorsea/commit/12bca3f37e60771c531929ceab47afcbe980887e))
6+
7+
8+
## [1.0.1](https://github.com/waterbeside/colorsea/compare/v0.3.3...v1.0.1) (2023-02-03)
9+
10+
### Features
11+
12+
* Random color ([96b8892](https://github.com/waterbeside/colorsea/commit/96b88927dfbfa89e154fbc9301704f6b99fceeaa))
13+

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# <span style="color: #1BA784">CO</span><span style="color:#1ba2a7">L</span><span style="color:#158BB8">OR</span><span style="color: #6f4faf">S</span><span style="color: #A35C8F">E</span><span style="color: #af4f4f">A</span>
1+
# COLORSEA
22

33
[For detailed documents, please click here](https://waterbeside.github.io/colorsea/)
44

5-
![](https://img.shields.io/bundlephobia/minzip/colorsea)
6-
![](https://img.shields.io/github/languages/top/waterbeside/colorsea)
7-
![](https://img.shields.io/npm/l/colorsea)
8-
![](https://img.shields.io/github/last-commit/waterbeside/colorsea)
5+
![minzipped size](https://img.shields.io/bundlephobia/minzip/colorsea)
6+
![typescript](https://img.shields.io/github/languages/top/waterbeside/colorsea)
7+
![license](https://img.shields.io/npm/l/colorsea)
8+
![last commit](https://img.shields.io/github/last-commit/waterbeside/colorsea)
9+
![build](https://img.shields.io/github/actions/workflow/status/waterbeside/colorsea/build.yml)
910

1011
[English](./README.md) | [简体中文](./README.zh-CN.md)
1112

README.zh-CN.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11

2-
# <span style="color: #1BA784">CO</span><span style="color:#1ba2a7">L</span><span style="color:#158BB8">OR</span><span style="color: #6f4faf">S</span><span style="color: #A35C8F">E</span><span style="color: #af4f4f">A</span>
2+
# COLORSEA
33

44
[详细文档请点这里](https://waterbeside.github.io/colorsea/zh/)
55

6-
![](https://img.shields.io/bundlephobia/minzip/colorsea)
7-
![](https://img.shields.io/github/languages/top/waterbeside/colorsea)
8-
![](https://img.shields.io/npm/l/colorsea)
9-
![](https://img.shields.io/github/last-commit/waterbeside/colorsea)
6+
![minzipped size](https://img.shields.io/bundlephobia/minzip/colorsea)
7+
![typescript](https://img.shields.io/github/languages/top/waterbeside/colorsea)
8+
![license](https://img.shields.io/npm/l/colorsea)
9+
![last commit](https://img.shields.io/github/last-commit/waterbeside/colorsea)
10+
![build](https://img.shields.io/github/actions/workflow/status/waterbeside/colorsea/build.yml)
1011

1112
[English](./README.md) | **简体中文**
1213

docs/.vuepress/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ export default defineUserConfig({
2626
'/': {
2727
lang: 'en-US', // 将会被设置为 <html> 的 lang 属性
2828
title: 'COLORSEA',
29-
description: 'A simple color space conversion and color manipulation library'
29+
description: 'Colorsea.js is a simple color space conversion and color manipulation library'
3030
},
3131
'/zh/': {
3232
lang: 'zh-CN',
3333
title: 'COLORSEA',
34-
description: '简单轻量的颜色空间转换和颜色操作查询库'
34+
description: 'colorsea.js - 简单轻量的颜色空间转换和颜色操作查询库'
3535
}
3636
},
3737
theme: defaultTheme({

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
home: true
3-
title: Home
3+
title: colorsea.js
44
actions:
55
- text: Get Started
66
link: /pages/QuickStart

docs/pages/ColorOperation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Color operation
2+
# Color manipulation
33

44
## Example
55

@@ -32,7 +32,7 @@ Increase lightness
3232
```typescript
3333
/**
3434
* Increase lightness
35-
* @param amount Brightness increase percentage, the default is 5, which means 5%
35+
* @param amount Lightness increase percentage, the default is 5, which means 5%
3636
* @param method If you fill in 'relative', it means that the parameter amount is a relative value
3737
* @returns Color
3838
*/
@@ -173,7 +173,7 @@ color mixing
173173

174174
```typescript
175175
/**
176-
* mix color
176+
* color mixing
177177
* @param color Another color, which can be a Color instance, a hexadecimal color string, or an [r, g, b] color tuple
178178
* @param weight The mixing ratio of another color, the default value is 50 or 50%
179179
* @returns Color

docs/pages/Converting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Color space converting
1+
# Color converting
22

33
After the **color instance** is created, the corresponding color space value can be obtained by the following methods of the color instance, so that the color space conversion can be easily carried out.
44

docs/pages/Value.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Color value and change value
2+
# Get and set value
33

44
## color.red()
55

@@ -190,6 +190,53 @@ Example:
190190
colorsea('#22994a').luma() // 0.23616959154733871
191191
```
192192

193+
## color.brightness()
194+
195+
get Brightness
196+
197+
range: [0, 100]
198+
199+
```typescript
200+
color.brightness() => number
201+
```
202+
203+
Example:
204+
205+
```typescript
206+
colorsea('#FFFFFF').brightness() // 100
207+
```
208+
209+
## color.visibility()
210+
211+
Check that one color is easily visible on another color,
212+
If false is returned, visibility is poor.
213+
214+
> refer to: https://www.w3.org/TR/AERT/#color-contrast
215+
216+
```typescript
217+
/**
218+
* @param anotherColor color for contrast
219+
* @param setting Setting value judged as poor visibility,{b, c}.
220+
* * b: brightness difference, the default value is 125, the range of brightness value is [0,255]
221+
* * c: color difference, the default value is 500
222+
*/
223+
color.visibility(
224+
anotherColor: Color | string | CommonColoraTuple | CommonColorTuple,
225+
setting?: { b: number; c: number }
226+
) => boolean
227+
```
228+
229+
Example:
230+
231+
```typescript
232+
colorsea('red').visibility(colorsea('#ee6666')) // false
233+
colorsea('#ffff00').visibility('#000000') // true
234+
```
235+
<ColorBox box-color="red" text-color="#ee6666">#ff0000, #ee6666, return false</ColorBox>,
236+
<ColorBox box-color="#ffff00" text-color="#000000">#ffff00, #000000, return true</ColorBox>
237+
238+
------
239+
193240
:::tip
194241
For methods such as `color.red()`,`color.green()`,`color.blue()`,`color.hue()`,`color.saturation()`,`color.lightness()`, `color.alpha()`,`color.luma()`, if the calculation result is a decimal, all decimal places will be returned, and the result will not be rounded or how many decimal places will be truncated.
195242
:::

docs/zh/Converting.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# 转换到其它颜色空间
2-
1+
# 颜色空间转换
32

43
创建color实例后,可以通过color实例的以下这些方法取得对应的颜色空间数值,从而轻易地进行颜色空间转换。
54

docs/zh/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
home: true
3-
title: 首页
3+
title: colorsea.js
44
actions:
55
- text: 快速上手
66
link: /zh/QuickStart

0 commit comments

Comments
 (0)