`plotly.colors.validate_colors` fails for valid colors and passes for invalid colors
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 18.8k
- Fork
- 2.8k
- Merge medio
- 16h 26m
- PR unite (30g)
- 21
Descrizione
This function raises a PlotlyError for color formats that are valid within traces, but also does not raise errors for color formats that are not valid.
Example of a valid color string that does not pass: color = 'hsl(290, 100%, 50%)'. This works perfectly fine if you construct a trace with it, but fails the validation test because it does not contain "rgb" or "#".
import plotly.graph_objects as go
import plotly.colors as pc
color = 'hsl(290, 100%, 50%)'
# this works
trace = go.Scatter(x=[0], y=[0], marker=dict(color=color))
fig = go.Figure(trace)
fig.show()
# this does not
pc.validate_colors(color) # this throws an error
Other cases:
- A valid, named color string throws an error
- The same named color within a list does not throw an error
- An invalid named color within a list does not throw an error, but it should
Examples below
import plotly.colors as pc
pc.validate_colors('red') # throws PlotlyError
pc.validate_colors(['red'])
>>> ['red']
pc.validate_colors(['asdflkjlaskdg'])
>>> ['asdflkjlaskdg']
Perhaps this function is not meant to be used in this way? If so then more information in the docstrings could be helpful.
Plotly version 5.24.1.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Parti dal punto di ingresso plotly.colors.validate_colors e riproduci gli esempi HSL, named-color, valid-list e invalid-list dell’issue. Traccia il modo in cui vengono convalidati gli input scalari e gli input di tipo lista. Il lavoro è completo quando i colori validi supportati dalle trace vengono accettati, i colori non validi vengono rifiutati in modo coerente e l’uso previsto della funzione è chiaro nella documentazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100