-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
1,572 additions
and
1,526 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import frostConfig from '@fr0st/eslint-config'; | ||
|
||
export default [ | ||
frostConfig | ||
]; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,114 @@ | ||
import assert from 'node:assert/strict'; | ||
import Color from './../src/index.js'; | ||
|
||
describe('Color Attributes', function() { | ||
|
||
describe('#getAlpha', function() { | ||
it('returns the alpha value', function() { | ||
assert.strictEqual( | ||
new Color(0, 0, 0, .75) | ||
.getAlpha(), | ||
.75 | ||
); | ||
}); | ||
}); | ||
|
||
describe('#getBrightness', function() { | ||
it('returns the brightness value', function() { | ||
assert.strictEqual( | ||
Color.fromHSV(180, 50, 75) | ||
.getBrightness(), | ||
75 | ||
); | ||
}); | ||
}); | ||
|
||
describe('#getHue', function() { | ||
it('returns the hue value', function() { | ||
assert.strictEqual( | ||
Color.fromHSV(270, 50, 50) | ||
.getHue(), | ||
270 | ||
); | ||
}); | ||
}); | ||
|
||
describe('#getSaturation', function() { | ||
it('returns the saturation value', function() { | ||
assert.strictEqual( | ||
Color.fromHSV(180, 25, 50) | ||
.getSaturation(), | ||
25 | ||
); | ||
}); | ||
}); | ||
|
||
describe('#luma', function() { | ||
it('returns the relative luma value', function() { | ||
assert.strictEqual( | ||
Color.fromHSV(180, 50, 50) | ||
.luma(), | ||
.17935225036098287 | ||
); | ||
}); | ||
}); | ||
|
||
describe('#setAlpha', function() { | ||
it('sets the alpha value', function() { | ||
const color1 = Color.fromHSV(120, 50, 50); | ||
const color2 = color1.setAlpha(.75); | ||
assert.strictEqual( | ||
color1.getAlpha(), | ||
1 | ||
); | ||
assert.strictEqual( | ||
color2.getAlpha(), | ||
.75 | ||
); | ||
}); | ||
}); | ||
|
||
describe('#setBrightness', function() { | ||
it('sets the brightness value', function() { | ||
const color1 = Color.fromHSV(180, 50, 50); | ||
const color2 = color1.setBrightness(75); | ||
assert.strictEqual( | ||
color1.getBrightness(), | ||
50 | ||
); | ||
assert.strictEqual( | ||
color2.getBrightness(), | ||
75 | ||
); | ||
}); | ||
}); | ||
|
||
describe('#setHue', function() { | ||
it('sets the hue value', function() { | ||
const color1 = Color.fromHSV(180, 50, 50); | ||
const color2 = color1.setHue(270); | ||
assert.strictEqual( | ||
color1.getHue(), | ||
180 | ||
); | ||
assert.strictEqual( | ||
color2.getHue(), | ||
270 | ||
); | ||
}); | ||
}); | ||
|
||
describe('#setSaturation', function() { | ||
it('sets the saturation value', function() { | ||
const color1 = Color.fromHSV(180, 50, 50); | ||
const color2 = color1.setSaturation(25); | ||
assert.strictEqual( | ||
color1.getSaturation(), | ||
50 | ||
); | ||
assert.strictEqual( | ||
color2.getSaturation(), | ||
25 | ||
); | ||
}); | ||
}); | ||
|
||
}); | ||
import assert from 'node:assert/strict'; | ||
import Color from './../src/index.js'; | ||
|
||
describe('Color Attributes', function() { | ||
describe('#getAlpha', function() { | ||
it('returns the alpha value', function() { | ||
assert.strictEqual( | ||
new Color(0, 0, 0, .75) | ||
.getAlpha(), | ||
.75, | ||
); | ||
}); | ||
}); | ||
|
||
describe('#getBrightness', function() { | ||
it('returns the brightness value', function() { | ||
assert.strictEqual( | ||
Color.fromHSV(180, 50, 75) | ||
.getBrightness(), | ||
75, | ||
); | ||
}); | ||
}); | ||
|
||
describe('#getHue', function() { | ||
it('returns the hue value', function() { | ||
assert.strictEqual( | ||
Color.fromHSV(270, 50, 50) | ||
.getHue(), | ||
270, | ||
); | ||
}); | ||
}); | ||
|
||
describe('#getSaturation', function() { | ||
it('returns the saturation value', function() { | ||
assert.strictEqual( | ||
Color.fromHSV(180, 25, 50) | ||
.getSaturation(), | ||
25, | ||
); | ||
}); | ||
}); | ||
|
||
describe('#luma', function() { | ||
it('returns the relative luma value', function() { | ||
assert.strictEqual( | ||
Color.fromHSV(180, 50, 50) | ||
.luma(), | ||
.17935225036098287, | ||
); | ||
}); | ||
}); | ||
|
||
describe('#setAlpha', function() { | ||
it('sets the alpha value', function() { | ||
const color1 = Color.fromHSV(120, 50, 50); | ||
const color2 = color1.setAlpha(.75); | ||
assert.strictEqual( | ||
color1.getAlpha(), | ||
1, | ||
); | ||
assert.strictEqual( | ||
color2.getAlpha(), | ||
.75, | ||
); | ||
}); | ||
}); | ||
|
||
describe('#setBrightness', function() { | ||
it('sets the brightness value', function() { | ||
const color1 = Color.fromHSV(180, 50, 50); | ||
const color2 = color1.setBrightness(75); | ||
assert.strictEqual( | ||
color1.getBrightness(), | ||
50, | ||
); | ||
assert.strictEqual( | ||
color2.getBrightness(), | ||
75, | ||
); | ||
}); | ||
}); | ||
|
||
describe('#setHue', function() { | ||
it('sets the hue value', function() { | ||
const color1 = Color.fromHSV(180, 50, 50); | ||
const color2 = color1.setHue(270); | ||
assert.strictEqual( | ||
color1.getHue(), | ||
180, | ||
); | ||
assert.strictEqual( | ||
color2.getHue(), | ||
270, | ||
); | ||
}); | ||
}); | ||
|
||
describe('#setSaturation', function() { | ||
it('sets the saturation value', function() { | ||
const color1 = Color.fromHSV(180, 50, 50); | ||
const color2 = color1.setSaturation(25); | ||
assert.strictEqual( | ||
color1.getSaturation(), | ||
50, | ||
); | ||
assert.strictEqual( | ||
color2.getSaturation(), | ||
25, | ||
); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.