Skip to content

Commit

Permalink
- Updated NPM.
Browse files Browse the repository at this point in the history
- Fixed lint issues.
  • Loading branch information
elusivecodes committed Jun 21, 2024
1 parent 6082448 commit 305fab4
Show file tree
Hide file tree
Showing 13 changed files with 1,572 additions and 1,526 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

36 changes: 0 additions & 36 deletions .eslintrc.json

This file was deleted.

5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import frostConfig from '@fr0st/eslint-config';

export default [
frostConfig
];
588 changes: 342 additions & 246 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fr0st/color",
"version": "4.1.4",
"version": "4.1.5",
"description": "FrostColor is a free, open-source color manipulation library for JavaScript.",
"keywords": [
"color",
Expand Down Expand Up @@ -28,7 +28,7 @@
"scripts": {
"build": "npm run js-compile && npm run js-minify",
"js-compile": "rollup --config",
"js-lint": "eslint --ext .js .",
"js-lint": "eslint",
"js-minify": "terser --compress passes=2 --mangle --source-map \"content=dist/frost-color.js.map\" --output dist/frost-color.min.js dist/frost-color.js",
"test": "mocha --recursive"
},
Expand All @@ -40,10 +40,10 @@
"license": "MIT",
"private": false,
"devDependencies": {
"eslint": "^8.54.0",
"eslint-config-google": "^0.14.0",
"mocha": "^10.2.0",
"rollup": "^4.6.0",
"terser": "^5.24.0"
"@fr0st/eslint-config": "^1.0.0",
"eslint": "^9.5.0",
"mocha": "^10.4.0",
"rollup": "^4.18.0",
"terser": "^5.31.1"
}
}
230 changes: 114 additions & 116 deletions test/attributes.js
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,
);
});
});
});
Loading

0 comments on commit 305fab4

Please sign in to comment.