Coerce strings to colors automatically in expressions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
For some reason, the `'#ffff2f'` is not valid and it now requires the `to-color` conversion. Is this expected?
```js
paint: {
// does not work
// "line-color": [
// 'at',
// 2,
// ['literal', ['#d7191c', '#fdae31', '#ffff2f', '#a6d96a', '#1a9641']],
// ],
// works
"line-color": [
'to-color',
[
'at',
2,
['literal', ['#d7191c', '#fdae31', '#ffff2f', '#a6d96a', '#1a9641']],
]
],
},
```
Example: https://jsfiddle.net/NameFILIP/oLw1ysjm/42/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the line-color expression from the linked JSFiddle and trace how the expression result is validated for color properties. No source files or tests are named in the issue, so identify the relevant expression and paint-property code first. Done means the expected handling of hexadecimal color strings is established and covered by the appropriate behavior or documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100