mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Transparent background for custom icons (#3145)
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
4096b87f99
commit
ad6224ad8c
@ -72,9 +72,21 @@ function getIconString(title: string) {
|
|||||||
export function Avatar(props: Props) {
|
export function Avatar(props: Props) {
|
||||||
const { title, width = 32, height = 32, colorHash, children, background, ...settings } = props;
|
const { title, width = 32, height = 32, colorHash, children, background, ...settings } = props;
|
||||||
|
|
||||||
|
const getBackgroundColor = () => {
|
||||||
|
if (background) {
|
||||||
|
return background;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.src) {
|
||||||
|
return "transparent";
|
||||||
|
}
|
||||||
|
|
||||||
|
return randomColor({ seed: colorHash, luminosity: "dark" });
|
||||||
|
};
|
||||||
|
|
||||||
const generateAvatarStyle = (): React.CSSProperties => {
|
const generateAvatarStyle = (): React.CSSProperties => {
|
||||||
return {
|
return {
|
||||||
backgroundColor: background || randomColor({ seed: colorHash, luminosity: "dark" }),
|
backgroundColor: getBackgroundColor(),
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
textTransform: "uppercase"
|
textTransform: "uppercase"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user