Skip to content

Commit

Permalink
fix: use "HSL" instead of "HLS" color format
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschwendener committed Jul 26, 2024
1 parent 072b1fd commit 936a038
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe(ColorConverterExtension, () => {
expect(colorConverterExtension.getSettingDefaultValue("key")).toEqual(undefined));

it("should return the default formats when passing 'formats' as key", () =>
expect(colorConverterExtension.getSettingDefaultValue("formats")).toEqual(["HEX", "HLS", "RGB"]));
expect(colorConverterExtension.getSettingDefaultValue("formats")).toEqual(["HEX", "HSL", "RGB"]));
});

describe(ColorConverterExtension.prototype.isSupported, () =>
Expand Down Expand Up @@ -68,7 +68,7 @@ describe(ColorConverterExtension, () => {
const colorConverter = <ColorConverter>{
convertFromString: vi.fn().mockReturnValue(<ColorConversionResult[]>[
{ format: "HEX", value: "#FFFFFF" },
{ format: "HLS", value: "hsl(0, 0%, 100%)" },
{ format: "HSL", value: "hsl(0, 0%, 100%)" },
{ format: "RGB", value: "rgb(255, 255, 255)" },
]),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ColorConverterExtension implements Extension {
};

private readonly defaultSettings = {
formats: ["HEX", "HLS", "RGB"],
formats: ["HEX", "HSL", "RGB"],
};

public constructor(
Expand Down
8 changes: 4 additions & 4 deletions src/main/Extensions/ColorConverter/QixColorConverter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ describe(QixColorConverter, () => {
it("should be able to parse hex colors", () => {
expect(new QixColorConverter().convertFromString("#fff")).toEqual(<ColorConversionResult[]>[
{ format: "HEX", value: "#FFFFFF" },
{ format: "HLS", value: "hsl(0, 0%, 100%)" },
{ format: "HSL", value: "hsl(0, 0%, 100%)" },
{ format: "RGB", value: "rgb(255, 255, 255)" },
]);

expect(new QixColorConverter().convertFromString("#ffffff")).toEqual(<ColorConversionResult[]>[
{ format: "HEX", value: "#FFFFFF" },
{ format: "HLS", value: "hsl(0, 0%, 100%)" },
{ format: "HSL", value: "hsl(0, 0%, 100%)" },
{ format: "RGB", value: "rgb(255, 255, 255)" },
]);
});

it("should be able to parse rgb colors", () => {
expect(new QixColorConverter().convertFromString("rgb(255,255,255)")).toEqual(<ColorConversionResult[]>[
{ format: "HEX", value: "#FFFFFF" },
{ format: "HLS", value: "hsl(0, 0%, 100%)" },
{ format: "HSL", value: "hsl(0, 0%, 100%)" },
{ format: "RGB", value: "rgb(255, 255, 255)" },
]);

expect(new QixColorConverter().convertFromString("rgba(255,255,255,1)")).toEqual(<ColorConversionResult[]>[
{ format: "HEX", value: "#FFFFFF" },
{ format: "HLS", value: "hsl(0, 0%, 100%)" },
{ format: "HSL", value: "hsl(0, 0%, 100%)" },
{ format: "RGB", value: "rgb(255, 255, 255)" },
]);
});
Expand Down
2 changes: 1 addition & 1 deletion src/main/Extensions/ColorConverter/QixColorConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class QixColorConverter implements ColorConverter {

return [
{ format: "HEX", value: color.hex() },
{ format: "HLS", value: color.hsl().string() },
{ format: "HSL", value: color.hsl().string() },
{ format: "RGB", value: color.rgb().string() },
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const ColorConverterSettings = () => {
const extensionId = "ColorConverter";
const { t } = useTranslation(`extension[${extensionId}]`);

const allFormats = ["HEX", "HLS", "RGB"];
const allFormats = ["HEX", "HSL", "RGB"];

const { value: enabledFormats, updateValue: setEnabledFormats } = useExtensionSetting<string[]>({
extensionId,
Expand Down

0 comments on commit 936a038

Please sign in to comment.