-
Notifications
You must be signed in to change notification settings - Fork 262
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
Paul/asset gradient #4702
Paul/asset gradient #4702
Conversation
a29ebbd
to
2e80d7c
Compare
// The accent color will override the dot color when it is present. | ||
// To change this behavior, use 'keep' to preserve the dot color or | ||
// 'drop' to remove the dot completely: | ||
accent?: 'keep' | 'drop' |
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.
Per our discussion, it seems the better approach to lending the theme files the control it may need to respond to certain scene changes is to have background declarations per scene assetBackground
, marketsBackground
, etc. Each declaration can declare if it wants to use some values provided by the scene such as asset color or some other variables that the scene may procure. If it doesn't make sense that the scene can procure such a value, then the Theme.ts
file should parameterize the different background fields with respect to their capabilities; this can be done with a generic prop to ThemeDot
.
const scaledColor = multiplyHexColor(iconColor, theme.assetBackgroundColorScale) | ||
backgroundColors[0] = scaledColor |
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.
This scaling seems like a change rather than a refactor.
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 scale was hard coded and now is in the theme. The old scaling was based on alpha because there was a flat black background underneath. Now the background is only the gradient so we can't apply an alpha to it.
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, I see, so it's a way to achieve the ability to darken the background color from the theme file (because it's currently set to #00000000
, transparent black). Now we can darken or lighten the value...wait, we can lighten the value if we pass a scale > 1, so clipping is still an issue that should be handled in the "darkenHexColor" function. I'd argue "scaleHexColor" might be a better name because darkening isn't the only use.
import { EdgeAsset } from '../types/types' | ||
import { getCurrencyIconUris } from '../util/CdnUris' | ||
|
||
export const useIconColor = (edgeAsset: EdgeAsset): string | undefined => { |
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.
Why aren't we using this this TransactionListScene
for consistency?
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.
Because we'd be grabbing the icon color twice. The TxListScene already loads the icon for other purposes so we get the color then.
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.
My suggestion was to gut the icon grab out of the CyptoIconUi4
in favor of this hook. But, no worries if not.
2e80d7c
to
14c53bb
Compare
This gives a more flexible API to modify any parameters of the dots on any screen.
14c53bb
to
f0ca7e7
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.
I'm approving this as I think it's ready. The only concern I have is with the hex color function which doesn't clip the color values.
* @param scaleFactor 0-1 with 0 being black, 1 is unchanged | ||
* @returns darkened hex color string | ||
*/ | ||
export const darkenHexColor = (hexColor: string, scaleFactor: number): string => { |
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 this makes a lot more sense. Can we keep the alpha channel for the hexColor?
const scaledColor = multiplyHexColor(iconColor, theme.assetBackgroundColorScale) | ||
backgroundColors[0] = scaledColor |
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, I see, so it's a way to achieve the ability to darken the background color from the theme file (because it's currently set to #00000000
, transparent black). Now we can darken or lighten the value...wait, we can lighten the value if we pass a scale > 1, so clipping is still an issue that should be handled in the "darkenHexColor" function. I'd argue "scaleHexColor" might be a better name because darkening isn't the only use.
import { EdgeAsset } from '../types/types' | ||
import { getCurrencyIconUris } from '../util/CdnUris' | ||
|
||
export const useIconColor = (edgeAsset: EdgeAsset): string | undefined => { |
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.
My suggestion was to gut the icon grab out of the CyptoIconUi4
in favor of this hook. But, no worries if not.
/rebase |
This let's specific scenes override the background with a gradient of their choice. TransactionList overrides by taking the iconColor and scaling it down
This matches more nicely with all the variable/identifier names.
bb018f7
to
a90214b
Compare
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneRequirements
If you have made any visual changes to the GUI. Make sure you have: