yoheinakajima / instagraph

Converts text input or URL into knowledge graph and displays
MIT License
3.27k stars 281 forks source link

refactor getTextColor #72

Closed isamu closed 10 months ago

isamu commented 10 months ago

Summary by CodeRabbit

coderabbitai[bot] commented 10 months ago

Walkthrough

The changes primarily focus on simplifying the getTextColor function in index.html. The logic for calculating the brightness of the background color has been streamlined, removing unnecessary checks and conditionals, and enhancing the readability and performance of the code.

Changes

File Summary
templates/index.html The getTextColor function has been optimized. Unnecessary checks for null or undefined values of bgColor have been removed. The function now directly calculates the brightness using the RGB values from bgColor and returns either #ffffff or #000000 based on the brightness value.

🐇

"In the land of code, where logic is king,

Simplified functions make the heart sing.

No more checks, no more fuss,

Just clean code, without a fuss.

Celebrate the changes, for they are grand,

In the world of code, they make a stand!" 🎉

Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - Mention `@coderabbitai` in any *review comment* for bot assistance. - Note: Review comments are made on code diffs or files, not on the PR overview. ### Pause Incremental Reviews - Insert `@coderabbitai: ignore` in the PR description to halt the bot's ongoing reviews. Remove the line to resume. - Additionally, enter `@coderabbitai pause` to halt the bot's ongoing reviews as any issue or review comment. To resume reviews, enter `@coderabbitai resume` as any issue or review comment.