question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I can't set color: rgb(0,74,153)

See original GitHub issue

Hi, if i try to set color rgb(0,74,153) which is a strong blue, i get an error.

Uncaught (in promise) Error: green must be at least 0 and at most 1, but was actually 74

it seems to accept only values from 0 to 1. for example color: rgb (0,0,1); are ok rgb(0,74,153) are bad

I need to use color like illustrator rgb palette which is expressed with values greater than 0 and 1.

How can I solve this little problem?

Thank you

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Hopdingcommented, Nov 14, 2020

Hello @sundsx! Good question. pdf-lib expresses colors as fractional values between 0 and 1. You can divide each of your color component values by 255 to produce the correct fractional value. For example:

rgb(0 / 255, 74 / 255, 153 / 255)
0reactions
robolicommented, Sep 9, 2022

Happy to accept documentation update PRs!

Not much but hope it helps https://github.com/Hopding/pdf-lib-docs/pull/39

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can someone tell me where to insert the RGB values to ...
Can someone tell me where to insert the RGB values to change the color of text? Original Title: RGB color values. Remember -...
Read more >
setBackground(new color()); in java does not understand the ...
I have a program with some gui, on the JFrame I set, setBackground( new Color(107, 106, 104) ); [The problem] It gives a...
Read more >
Setting Accessible RGB Values from Hex Codes in PowerPoint
PowerPoint uses RGB values for a color. RGB stands for red, greeb, ... try restarting your device. Your browser can't play this video....
Read more >
MANUALLY CHANGE RGB COLORS IN FINAL CUT PRO [+ ...
Learn how to manually set RGB colors in Final Cut Pro.This helpful tutorial will guide you step-by-step so you can change, control and...
Read more >
RGB Color Codes Chart - RapidTables.com
Color Name Hex Code. #RRGGBB Decimal Code. R,G,B maroon #800000 (128,0,0) dark red #8B0000 (139,0,0) brown #A52A2A (165,42,42)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found