Skip to content

Commit

Permalink
feat(ansi): add bright boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
sgoudham committed Nov 10, 2024
1 parent b85d36a commit f75b522
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 69 deletions.
23 changes: 18 additions & 5 deletions mod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,35 @@ Deno.test("flavors", () => {
});
});

Deno.test("ansiEntries", () => {
flavorEntries.map(([flavorName, flavor]) => {
flavor.ansiColorEntries.map(([ansiColorName, ansiColor]) => {
Deno.test("ansiEntries - name", () => {
flavorEntries.map(([_, flavor]) => {
flavor.ansiColorEntries.map(([_, ansiColor]) => {
assertEquals(
ansiColor.normal.name,
ansiColor.name
ansiColor.name,
);
assertEquals(
ansiColor.bright.name,
`Bright ${ansiColor.name}`
`Bright ${ansiColor.name}`,
);
});
});
});

Deno.test("ansiEntries - hex", () => {
flavorEntries.map(([flavorName, flavor]) => {
flavor.ansiColorEntries.map(([ansiColorName, ansiColor]) => {
assertEquals(
ansiColor.normal.hex,
palette[flavorName].ansiColors[ansiColorName].normal.hex,
);
});
});
});

Deno.test("ansiEntries - hex (black & white)", () => {
flavorEntries.map(([flavorName, flavor]) => {
flavor.ansiColorEntries.map(([ansiColorName, ansiColor]) => {
if (ansiColorName == "black") {
if (flavorName == "latte") {
assertEquals(
Expand Down
5 changes: 5 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ export type AnsiColorFormat = Readonly<{
* @example 4
*/
code: number;

/**
* Indicates whether the ANSI color is a "normal" or "bright" color.
*/
bright: boolean;
}>;

const { version: _, ...jsonFlavors } = definitions;
Expand Down
Loading

0 comments on commit f75b522

Please sign in to comment.