Skip to content

Fix zero-valued token colors - #105

Open
koriyoshi2041 wants to merge 1 commit into
TransformerLensOrg:mainfrom
koriyoshi2041:fix/zero-token-color
Open

Fix zero-valued token colors#105
koriyoshi2041 wants to merge 1 commit into
TransformerLensOrg:mainfrom
koriyoshi2041:fix/zero-token-color

Conversation

@koriyoshi2041

Copy link
Copy Markdown

Summary

  • return the documented neutral white color for exact zero values
  • add a regression for an all-zero token-color domain

Why

When value, min, and max are all zero, the positive branch evaluates 0 / max as 0 / 0. The resulting NaN mix is materialized as transparent black, so the foreground selector chooses white text and makes zero-valued tokens unreadable on the white page background.

Verification

  • Node 18 Jest: 6 suites, 27 tests passed
  • TypeScript typecheck
  • ESLint
  • browser and Node builds
  • git diff --check

Closes #92.

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.

[Bug] colored_tokens generates unreadable text when values are all zero

1 participant