Skip to content

Commit b01e2ba

Browse files
authored
tags: remove hard coded colors (#102539)
Tag summary was using hardcoded colors. First two screenshots are UI1 in prod, second two are UI1 with the changes from this PR and last two are UI2 with changes from this PR. If needed, we can keep the old colors for UI1, and adjust this only for UI2, but I'd rather that we get rid of hardcoded colors entirely cc @Jesse-Box for design blessing 🙏🏼 <table> <tr> <td><img width="740" height="1410" alt="CleanShot 2025-11-02 at 13 22 36@2x" src="https://github.com/user-attachments/assets/8bafe928-5e30-44ad-9b0a-1e0cf3052d65" /></td> <td><img width="740" height="1400" alt="CleanShot 2025-11-02 at 13 22 52@2x" src="https://github.com/user-attachments/assets/3de7383c-9a99-4221-ac0b-b11d47d1a28e" /></td> <tr> <td> <img width="738" height="1436" alt="CleanShot 2025-11-02 at 13 21 13@2x" src="https://github.com/user-attachments/assets/58b47dfe-7667-4377-9901-a985c566bfea" /> </td> <td> <img width="746" height="1412" alt="CleanShot 2025-11-02 at 13 21 19@2x" src="https://github.com/user-attachments/assets/648b2256-515f-4541-b3a4-82b65276fd91" /> </td> <tr> <td> <img width="734" height="1526" alt="CleanShot 2025-11-02 at 13 21 05@2x" src="https://github.com/user-attachments/assets/6b9c2c0e-af1e-4d33-9044-958f61486631" /> </td> <td> <img width="734" height="1540" alt="CleanShot 2025-11-02 at 13 20 48@2x" src="https://github.com/user-attachments/assets/5ee27150-6cb6-46ca-a270-9acbc565a71a" /> </td> </table>
1 parent 25d4ac7 commit b01e2ba

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

static/app/components/group/tagFacets/tagFacetsDistributionMeter.tsx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import {useState} from 'react';
22
import isPropValid from '@emotion/is-prop-valid';
3+
import {useTheme} from '@emotion/react';
34
import styled from '@emotion/styled';
45
import {AnimatePresence, motion} from 'framer-motion';
56
import type {LocationDescriptor} from 'history';
67

78
import type {TagSegment} from 'sentry/actionCreators/events';
89
import {Button} from 'sentry/components/core/button';
910
import {Link} from 'sentry/components/core/link';
11+
import {Text} from 'sentry/components/core/text';
1012
import {Tooltip} from 'sentry/components/core/tooltip';
1113
import {IconChevron} from 'sentry/icons/iconChevron';
1214
import {t} from 'sentry/locale';
@@ -19,7 +21,6 @@ import {appendExcludeTagValuesCondition} from 'sentry/utils/queryString';
1921
import {useLocation} from 'sentry/utils/useLocation';
2022
import useOrganization from 'sentry/utils/useOrganization';
2123

22-
const COLORS = ['#402A65', '#694D99', '#9A81C4', '#BBA6DF', '#EAE2F8'];
2324
const MAX_SEGMENTS = 4;
2425
const TOOLTIP_DELAY = 800;
2526

@@ -36,7 +37,6 @@ type Props = {
3637
};
3738

3839
function TagFacetsDistributionMeter({
39-
colors = COLORS,
4040
segments,
4141
title,
4242
totalValues,
@@ -46,6 +46,8 @@ function TagFacetsDistributionMeter({
4646
expandByDefault,
4747
otherUrl,
4848
}: Props) {
49+
const theme = useTheme();
50+
const colors = theme.chart.getColorPalette(4);
4951
const location = useLocation();
5052
const organization = useOrganization();
5153
const [expanded, setExpanded] = useState<boolean>(!!expandByDefault);
@@ -124,7 +126,7 @@ function TagFacetsDistributionMeter({
124126
{value.isOther ? (
125127
<OtherSegment
126128
aria-label={t('Other segment')}
127-
color={colors[colors.length - 1]!}
129+
color={theme.chart.neutral}
128130
/>
129131
) : (
130132
<Segment
@@ -180,14 +182,12 @@ function TagFacetsDistributionMeter({
180182
onMouseLeave={() => setHoveredValue(null)}
181183
>
182184
<LegendDot
183-
color={colors[segment.isOther ? colors.length - 1 : index]!}
185+
color={segment.isOther ? theme.chart.neutral : colors[index]!}
184186
focus={focus}
185187
/>
186188
<Tooltip skipWrapper delay={TOOLTIP_DELAY} title={segment.name}>
187189
<LegendText unfocus={unfocus}>
188-
{segment.name ?? (
189-
<NotApplicableLabel>{t('n/a')}</NotApplicableLabel>
190-
)}
190+
{segment.name ?? <Text variant="muted">{t('n/a')}</Text>}
191191
</LegendText>
192192
</Tooltip>
193193
<LegendPercent>{`${pctLabel}%`}</LegendPercent>
@@ -282,7 +282,7 @@ const Title = styled('div')`
282282

283283
const TitleType = styled('div')`
284284
flex: none;
285-
color: ${p => p.theme.textColor};
285+
color: ${p => p.theme.tokens.content.primary};
286286
font-weight: ${p => p.theme.fontWeight.bold};
287287
font-size: ${p => p.theme.fontSize.md};
288288
margin-right: ${space(1)};
@@ -292,7 +292,7 @@ const TitleType = styled('div')`
292292
const TitleDescription = styled('div')`
293293
${p => p.theme.overflowEllipsis};
294294
display: flex;
295-
color: ${p => p.theme.subText};
295+
color: ${p => p.theme.tokens.content.primary};
296296
text-align: right;
297297
font-size: ${p => p.theme.fontSize.md};
298298
${p => p.theme.overflowEllipsis};
@@ -368,26 +368,23 @@ const LegendText = styled('span')<{unfocus: boolean}>`
368368
white-space: nowrap;
369369
text-overflow: ellipsis;
370370
transition: color 0.3s;
371-
color: ${p => (p.unfocus ? p.theme.gray300 : p.theme.gray400)};
371+
color: ${p =>
372+
p.unfocus ? p.theme.tokens.content.muted : p.theme.tokens.content.primary};
372373
`;
373374

374375
const LegendPercent = styled('span')`
375376
font-size: ${p => p.theme.fontSize.sm};
376377
margin-left: ${space(1)};
377-
color: ${p => p.theme.subText};
378+
color: ${p => p.theme.tokens.content.primary};
378379
text-align: right;
379380
flex-grow: 1;
380381
`;
381382

382383
const ExpandToggleButton = styled(Button)`
383-
color: ${p => p.theme.subText};
384+
color: ${p => p.theme.tokens.content.muted};
384385
margin-left: ${space(0.5)};
385386
`;
386387

387-
const NotApplicableLabel = styled('span')`
388-
color: ${p => p.theme.subText};
389-
`;
390-
391388
const StyledSummary = styled('summary')`
392389
&::-webkit-details-marker {
393390
display: none;

0 commit comments

Comments
 (0)