Skip to content

refactor(update): remove use of @std/fmt/colors#2887

Closed
iuioiua wants to merge 1 commit intodenoland:mainfrom
iuioiua:remove-colors-update
Closed

refactor(update): remove use of @std/fmt/colors#2887
iuioiua wants to merge 1 commit intodenoland:mainfrom
iuioiua:remove-colors-update

Conversation

@iuioiua
Copy link
Copy Markdown
Contributor

@iuioiua iuioiua commented May 5, 2025

This module simply isn't needed as console methods support CSS styles natively.

Copy link
Copy Markdown
Contributor

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks color output in macOS' built-in Terminal app. That one famously doesn't support 16bit truecolor and only up to ansi256.

import * as colors from "jsr:@std/fmt/colors";

console.log("Before:");
console.log(colors.bgRgb8(
  colors.rgb8(" 🍋 Fresh Updater ", 0),
  121,
));
console.log();
console.log("With this PR:");
console.log("%c 🍋 Fresh Updater ", "background-color: #87ffaf; color: black;");
Screenshot 2025-05-05 at 08 36 40

@iuioiua
Copy link
Copy Markdown
Contributor Author

iuioiua commented May 5, 2025

Ah, yes, that's right! In that case, I'd almost go as far as to say that any background styling in console methods should be recommended against. Does denoland/deno#18549 or denoland/deno#28122 fix this issue?

@marvinhagemeister
Copy link
Copy Markdown
Contributor

Yeah the first one would fix it. We don't have any code in the console at the moment to convert from 16bit colors to ansi256.

@iuioiua
Copy link
Copy Markdown
Contributor Author

iuioiua commented May 5, 2025

I've done no prior reading on how it all works, so I have essentially zero context. It'd be great if we can re-open and complete that PR. From what I remember, tests were all that remain. Is that correct? Fixing that would also help fix https://github.com/denoland/std/blob/6a00d6cd34ca70b3a38932e313151a80531c5d2b/internal/build_message.ts#L29.

@iuioiua iuioiua closed this May 6, 2025
@iuioiua iuioiua deleted the remove-colors-update branch May 6, 2025 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants