-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] *: standardization of color representation #2163
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's always nice to standardize things 👍
@@ -13,7 +13,7 @@ import { Range } from "./range"; | |||
* Intellisense from resolving it. | |||
* See https://github.com/microsoft/TypeScript/issues/31940#issuecomment-841712377 | |||
*/ | |||
export type Alias = {}; | |||
export type Alias = {} & {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typing on mouse hover seemse to be workign now in VS code on my pc 😊
While we're there we could take the occasion to correclty type the colors that we missed previously. For example the colors in the cell Style, or all the color constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a commit for this. I might have overlooked some occurences though
260f29e
to
a3b0cf8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only ° in a docstring
src/helpers/color.ts
Outdated
@@ -34,7 +37,10 @@ export function getNextColor() { | |||
|
|||
/** | |||
* Converts any CSS color value to a standardized hex6 value. | |||
* Accepts: hex3, hex6, hex8 and rgb (rgba is not supported) | |||
* Accepts: hex3, hex6, hex8, rgb° and rgba°. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
°
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah oui...
needs to be rebased
src/plugins/ui/custom_colors.ts
Outdated
@@ -104,7 +104,7 @@ export class CustomColorsPlugin extends UIPlugin { | |||
// again | |||
[...new Set([...usedColors, ...this.customColors])] | |||
.filter(isColorValid) | |||
.map((c) => toHex(c).toLowerCase()) | |||
.map((c) => toHex(c)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be simplified to .map(toHex)
@@ -14,7 +14,7 @@ | |||
<ColorPicker | |||
t-if="state.openedColorPicker === 'backgroundColor'" | |||
onColorPicked="(color) => this.setColor(color, 'backgroundColor')" | |||
currentColor="props.definition.brackground" | |||
currentColor="props.definition.background" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
a8b19af
to
4b1ad7a
Compare
The Alias introduced to prevent Intellisense to resolve simple aliases was broken. As a reminder, it allows us for example to type specific string as `UID` and prevent the variables to be noted as `string`later on in the code.
We handle colors as 'css-valid' representations, as such, several repesentations are equivalent but cannot be compared by strict equality, they need to be converted to the same representation. This commit aims to unify to the uppercase hex representation as it follows the representation yielded by the helper `toHex` which (at this point in time) seems to be the 'rallying' point when manipulating colors. Task: 3193882
The color picker would not close when the user would click outside of it for the design panels of gauge and scorecard charts. The duplication of design panles is probably to blame here.
4b1ad7a
to
ccdaaaa
Compare
@LucasLefevre I rebased the branch and changes the docstring with the ° char to something more clear (I hope^^) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
robodoo r+
robodoo rebase-ff |
Merge method set to rebase and fast-forward. |
The Alias introduced to prevent Intellisense to resolve simple aliases was broken. As a reminder, it allows us for example to type specific string as `UID` and prevent the variables to be noted as `string`later on in the code. Part-of: #2163
We handle colors as 'css-valid' representations, as such, several repesentations are equivalent but cannot be compared by strict equality, they need to be converted to the same representation. This commit aims to unify to the uppercase hex representation as it follows the representation yielded by the helper `toHex` which (at this point in time) seems to be the 'rallying' point when manipulating colors. Task: 3193882 Part-of: #2163
The color picker would not close when the user would click outside of it for the design panels of gauge and scorecard charts. The duplication of design panles is probably to blame here. Part-of: #2163
closes #2163 Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
@rrahir @LucasLefevre this pull request has forward-port PRs awaiting action (not merged or closed): |
Description:
We handle colors as 'css-valid' representations, as such, several
repesentations are equivalent but cannot be compared by strict equality,
they need to be converted to the same representation. This commit
aims to unify to the uppercase hex representation as it follows the
representation yielded by the helper
toHex
which (at this point intime) seems to be the 'rallying' point when manipulating colors.
Task: 3193882
Odoo task ID : TASK_ID
review checklist