Skip to content

Commit

Permalink
rename getHexValues to getHexColorRGBvalues
Browse files Browse the repository at this point in the history
  • Loading branch information
heyjul3s committed Feb 17, 2021
1 parent bed7079 commit 48bc625
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/hextorgb/__tests__/hextorgb.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
hexToRGB,
getRGBvalues,
getHexColorRGBvalues,
splitHexToRGB,
formatHexValue,
expandShorthandHex,
Expand Down Expand Up @@ -70,15 +70,15 @@ describe('@artifak/hextorgb', () => {

describe('getRGBvalues', () => {
it('returns an object with RGB values', () => {
expect(getRGBvalues('#DF3EA1')).toMatchObject({
expect(getHexColorRGBvalues('#DF3EA1')).toMatchObject({
r: 223,
g: 62,
b: 161
});
});

it('returns UNDEFINED with invalid hex string values', () => {
expect(getRGBvalues('Hello World')).toEqual(void 0);
expect(getHexColorRGBvalues('Hello World')).toEqual(void 0);
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/hextorgb/src/hextorgb.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { RGBColor } from './typings';

export function hexToRGB(hex: string): string | void {
const color = getRGBvalues(hex);
const color = getHexColorRGBvalues(hex);

if (!!color) {
return `rgb(${color.r}, ${color.g}, ${color.b})`;
}
}

export function getRGBvalues(hex: string): RGBColor | void {
export function getHexColorRGBvalues(hex: string): RGBColor | void {
const hexValue = formatHexValue(hex);

if (!!hexValue) {
Expand Down
2 changes: 1 addition & 1 deletion packages/hextorgb/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { hexToRGB, getRGBvalues } from './hextorgb';
export { hexToRGB, getHexColorRGBvalues } from './hextorgb';
export { RGBColor } from './typings';
4 changes: 2 additions & 2 deletions packages/hextorgba/src/hextorgba.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getRGBvalues } from '@artifak/hextorgb';
import { getHexColorRGBvalues } from '@artifak/hextorgb';

export function hexToRGBA(hex: string, alpha = 1): string | void {
const color = getRGBvalues(hex);
const color = getHexColorRGBvalues(hex);

if (!!color) {
return `rgba(${color.r}, ${color.g}, ${color.b}, ${alpha})`;
Expand Down
2 changes: 1 addition & 1 deletion packages/hextorgba/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { hexToRGBA } from './hextorgba';
export { getRGBvalues } from '@artifak/hextorgb';
export { getHexColorRGBvalues } from '@artifak/hextorgb';

0 comments on commit 48bc625

Please sign in to comment.