Skip to content

feat(traffic): draw the AI Traffic and Mentions charts in the brand's colors - #1217

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/brand-chart-colors
Oct 20, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/brand-chart-colors

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

The AI Traffic and Mentions charts now draw in the brand's colors instead of shades of one violet.

AI Traffic (traffic/_charts.tsx): the AI Referral Trend, Platform Breakdown and the Referrals by Platform dots read their colors from PLATFORM_COLORS, which was all indigo/violet. Now:

Engine Color
ChatGPT (all three hosts) ink: var(--primary), black on light, near-white on dark
Claude terracotta #c2603f
Perplexity teal #3f6f68
Gemini ochre #c9973b
Copilot blue-grey #5f7f9a
Others olive, plum, rust, sand, steel and the like
unknown warm grey #a8a29a
  • In the "vs Google clicks" view, the AI line is ink too. Google keeps its green and the markers their amber.
  • Every engine on ai-sources.json still has its own color; traffic-platforms.test.ts passes.

Mentions (mentions/_trend-chart.tsx): the "Mentions & sentiment over time" line and its fill are ink (var(--primary)) instead of indigo, so they stay visible in dark mode.

These are the warm, earthy tones from the brand style reference. Two files, colors only.

Related issue

None. A user request ("too much purple on AI Traffic; use our brand colors; the Mentions chart's purple can be black").

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Open /dashboard/traffic on a range with several engines. Check:
    • AI Referral Trend and Platform Breakdown show ChatGPT in black and the others in distinct warm tones;
    • in dark mode, ChatGPT turns near-white.
  2. Open /dashboard/mentions. The "Mentions & sentiment over time" line is black, and light in dark mode.

I checked both pages locally in light and dark themes. var(--primary) works in the SVG strokes, fills and gradient stops.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run: yarn test (1,694 pass) and yarn build (with the CI placeholders).

🤖 Generated with Claude Code

… colors

The AI Referral Trend, Platform Breakdown and Referrals by Platform used shades of one violet for every engine, and the Mentions trend and the AI line versus Google clicks used indigo. ChatGPT, the AI line and the Mentions line now draw in ink (the theme's primary: black on light, near-white on dark), and the other engines in warm, earthy tones that read on both themes and apart from one another.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk A small one: the AI Traffic platform colors and the Mentions trend line move from violet/indigo to the brand's colors. ChatGPT, the AI line and the Mentions line use ink (var(--primary), so they turn light in dark mode); the other engines use warm, earthy tones. Two files, colors only, checked in both themes. It touches traffic/_charts.tsx, which the AI Traffic stack doesn't change, so there's no conflict there.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked on main with #1218, #1220 and #1221: web tests pass. var(--primary) is used only in fill, stroke, stopColor and inline styles, where a CSS variable works. No color gets a hex alpha appended.

@gkhngyk
gkhngyk merged commit fe8c380 into ansvisor:main Oct 20, 2026
6 checks passed
gkhngyk pushed a commit that referenced this pull request Oct 20, 2026
The Similar Topics card on the Prompts page's Insights view drew its
bars in indigo, one of the last violet-blue accents after #1217, #1220
and #1221 moved the charts and badges to the brand's colors. They now
use bg-foreground/60, the gray the Mentions and Insights share bars
already use: dark gray on light, light gray on dark.

Co-authored-by: Cihan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@gkhngyk gkhngyk mentioned this pull request Oct 21, 2026
8 of 12 tasks
cihan-gyk added a commit to cihan-gyk/ansvisor that referenced this pull request Oct 21, 2026
…he shares are of responses naming a brand

- The radar draws the brand in ink (var(--primary)), as the rest of the
  Mentions page does since ansvisor#1217/ansvisor#1220, and the competitors in orange,
  teal and red (no violet); insights-trend keeps its palette to itself.
- The brand × attribute cells take a neutral tint instead of indigo.
- The shares are over the responses that name a brand, so the labels say
  "of responses naming …" rather than "of mentions", which on this page
  counts every time a brand is named.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk added a commit that referenced this pull request Oct 21, 2026
* feat(mentions): add the per-answer terms and the Perception read

The Perception tab's data (MS-09), deterministic as spec §9 asks for V1:

- migration 00161: mention_terms() takes the sentences of an answer that
  name an entity and returns their words and two-word phrases, minus stop
  words in 13 languages (Snowball dictionaries), words answers use about
  every brand alike, every brand's names and the question's own words;
  mentions_answer_terms keeps the distinct terms per answer and entity
  named (the brand or a competitor), filled by refresh_mentions_daily with
  the mention rollups; mentions_perception() reads a window and the one
  before: the brand's top terms with their trend, the 8 attributes that
  tell it and its four most mentioned competitors apart with each one's
  share of mentions, and the competitors named in the same answers
- the mention history refreshes three days a call: the terms make each
  call heavier than the citation rollups' fortnight
- web: getMentionsPerception, the parsed shape, shares, and the biggest
  gap (a competitor leading an attribute by 20+ points)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* perf(mentions): refresh the answer terms in their own function

Reading the answers' text for their terms takes about 2.4 ms per answer
and entity named: about 7 s for a recent day of the largest brand, and
more on its busier days. Inside refresh_mentions_daily that also ran in a
sentiment correction (00160), within the person's 8 s request, where the
terms never change.

refresh_mention_terms now holds that part, and refresh_mentions_daily
stays as 00157 wrote it. The server calls both for a completed run, the
nightly sweep and the backfill; the backfill goes a day at a time.

Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A

* fix(mentions): lock the terms refresh per brand, and refresh terms a day at a time

- refresh_mention_terms takes a per-brand advisory lock of its own, as
  refresh_mentions_daily does since 00192: a run's refresh and the nightly
  sweep can cover the same days, and the second insert would fail on the
  (result_id, entity) key.
- refreshMentionsDaily refreshes the rollups for the range in one call and
  the terms one day per call, so the sweep's three days stay well inside
  the service role's statement timeout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(mentions): show the Perception tab

The Mentions & Sentiment Perception tab (MS-09) reads mentions_perception
and shows what AI associates with the brand, a radar of the brand against
its three most mentioned competitors, the brand x attribute heat map, the
competitors named beside it and the biggest gap. The gap leaves out shares
taken over fewer than 20 mentions, as the Overview does, and only names a
brand the radar draws.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mentions): draw the brand in ink on the Perception tab, and say the shares are of responses naming a brand

- The radar draws the brand in ink (var(--primary)), as the rest of the
  Mentions page does since #1217/#1220, and the competitors in orange,
  teal and red (no violet); insights-trend keeps its palette to itself.
- The brand × attribute cells take a neutral tint instead of indigo.
- The shares are over the responses that name a brand, so the labels say
  "of responses naming …" rather than "of mentions", which on this page
  counts every time a brand is named.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Cihan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Gökhan Geyik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants