Best API for setting pen color?
See original GitHub issueRight now pen color can be set to any valid CSS color string (like red
, #f00
, rgb(255, 0, 0)
, or others).
This isn’t great because it doesn’t leave much wiggle room for setting color, saturation, brightness, or transparency independently (which is possible in Scratch).
What’s the best API for dealing with colors? Color strings are handy, but underpowered.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top Results From Across the Web
Applying styles and colors - Web APIs | MDN
In this example, we'll draw a background of four different colored squares. On top of these, we'll draw a set of semi-transparent circles....
Read more >Set pen/color for Polyline()? - winapi - Stack Overflow
Setting the DC pen and brush colors doesn't have any effect unless you have the DC pen and/or brush selected into the DC....
Read more >Color Palette API - API Documentation | Zyla API Hub
Color Palette API. Get random RGB color palletes for your projects. Also, receive suggested colors that could match your current colors. Get coherent...
Read more >The Turtle API | Turtle Graphics in CircuitPython on TFT Gizmo
The other form sets the pen color to the specified value. The Color class should be used for this value: WHITE , BLACK...
Read more >turtle — Turtle graphics — Python 3.11.1 documentation
Return or set the pen's attributes in a “pen-dictionary” with the following key/value pairs: “shown”: True/False. “pendown”: True/False. “pencolor”: color- ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@PullJosh
==
works for comparing them if you implement thetoString
function to return a color string (e.g. hex) — it’d be comparing those instead of the actual objects (which is what===
usually does).Add a
Color
type? This is somewhat similar to a specialPen
class, but unspecialised.I personally like RGB(A) much more than HSV(A), so providing the option would be nice 😃