FS#2671RColor > Automatically remove leading/trailing whitespace from custom colors name and color code
- Type
- Suggestion
- Status
- Assigned
- Category
- QCAD (main)
- Severity
- Very Low
- Priority
- Low
- Reported version
- n/a
- Operating system
- All
- Reported
- 2025-05-19 by CVH
- Votes
- 1
Andrew,
Initial tests for this reply on the forum failed because of a space.
I tend to add a space after a comma by habit. ;-)
For QCAD Pro RColor::init() additionally loads the user palette.
A list of colorstrings separated by an EOL and split up per line.
An empty colorstring is skipped (e.g. first of every imported palette)
Each of the colorstrings is split into tuples at a comma.
Not at least 2 tuples adds a separator line.
The last tuple is considered as a color code.
This is not validated as in range '#000000'-'#ffffff', starting with '#' + 6 characters '0-f'.
Anything before the last comma is considered as the custom name or 'title'.
This may be empty, include leading/trailing whitespace and/or include a comma.
Before the first custom entry it adds a separator line.
A color code starting with a space would be invalid.
Trailing spaces are not distinguishable in the preference page and also invalid.
It would already be neater to init a custom color from the list with:
init(title.trimmed(), RColor(code.trimmed()));
Presuming that .trimmed() is the cpp analog for String.prototype.trim in JS.
Regards,
CVH