79587181

Date: 2025-04-22 18:15:36
Score: 0.5
Natty:
Report link

You could do something like this:

library(ggplot2)
library(prismatic)
library(stringr)

blues <- grep("blue$", colors(), value = TRUE)

df <- data.frame(
  name = blues,
  str_len = str_length(blues)
)

ggplot(df, aes(x = str_len, y = name, label = str_len, fill = name)) +
  geom_col() +
  geom_text(
    mapping = aes(
      color = after_scale(best_contrast(fill, c("black", "white")))
    ),
    hjust = 1,
    nudge_x = -.25
  ) +
  scale_fill_identity()

enter image description here

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: Michiel Duvekot