Ticket #5605 (closed enhancement: fixed)
Construct Color objects using hsl and hsv values
| Reported by: | jason | Owned by: | was |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-4.4.2 |
| Component: | graphics | Keywords: | |
| Cc: | mvngu | Work issues: | |
| Report Upstream: | N/A | Reviewers: | |
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description (last modified by mpatel) (diff)
See http://en.wikipedia.org/wiki/HSL_and_HSV
See also this thread, where the idea came up: http://groups.google.com/group/sage-support/browse_thread/thread/44971aa416574675
Related tickets:
Change History
comment:2 Changed 4 years ago by mpatel
On the RGB converters:
sage: from sage.plot.colors import rgbcolor, to_mpl_color sage: rgbcolor('#ffffff') (0.99609375, 0.99609375, 0.99609375) sage: to_mpl_color('#ffffff') (1.0, 1.0, 1.0)
Both
Color(rgbcolor(hx)).html_color() == hx Color(to_mpl_color(hx)).html_color() == hx
are True for all hex colors hx, but we should fix rgbcolor and/or unify it with to_mpl_color. I'll do this as part of #5601's patch, which may also cover #5602 and, perhaps, this ticket.
comment:4 Changed 3 years ago by jason
- Cc mvngu added
- Report Upstream set to N/A
This works now. From the doctests of sage.plot.colors.Color:
sage: Color(0.5, 1.0, 1, space='hsv')
RGB color (0.0, 1.0, 1.0)
sage: Color(0.25, 0.5, 0.5, space='hls')
RGB color (0.50000000000000011, 0.75, 0.25)
So this should be closed.
comment:5 Changed 3 years ago by mvngu
- Status changed from new to closed
- Resolution set to fixed
Close as fixed:
[mvngu@sage ~]$ sage ---------------------------------------------------------------------- | Sage Version 4.4.1, Release Date: 2010-05-02 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: Color(0.5, 1.0, 1, space='hsv') RGB color (0.0, 1.0, 1.0) sage: Color(0.5, 1.0, 1, space='hls') RGB color (1.0, 1.0, 1.0) sage: Color(0.25, 0.5, 0.5, space='hls') RGB color (0.50000000000000011, 0.75, 0.25) sage: Color(0.25, 0.5, 0.5, space='hsv') RGB color (0.375, 0.5, 0.25)
Note: See
TracTickets for help on using
tickets.
