Skip to content

Commit

Permalink
✨ (grapher) update colour of exports
Browse files Browse the repository at this point in the history
For better consistency with static charts created in Figma
  • Loading branch information
sophiamersmann committed Jan 9, 2025
1 parent 04d8c52 commit b9167bd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
5 changes: 4 additions & 1 deletion packages/@ourworldindata/grapher/src/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ActionButtons } from "../controls/ActionButtons"
import {
BASE_FONT_SIZE,
GRAPHER_FRAME_PADDING_HORIZONTAL,
GRAPHER_LIGHT_TEXT,
} from "../core/GrapherConstants"
import { GRAPHER_DARK_TEXT } from "../color/ColorConstants"

Expand Down Expand Up @@ -640,7 +641,9 @@ export class StaticFooter extends Footer<StaticFooterProps> {
componentWillUnmount(): void {}

@computed private get textColor(): string {
return this.manager.secondaryColorInStaticCharts ?? GRAPHER_DARK_TEXT
return this.manager.isSocialMediaExport
? GRAPHER_DARK_TEXT
: GRAPHER_LIGHT_TEXT
}

@computed protected get showLicenseNextToSources(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface FooterManager extends TooltipManager, ActionButtonsManager {
isEmbeddedInADataPage?: boolean
hideNote?: boolean
hideOriginUrl?: boolean
secondaryColorInStaticCharts?: string
isStaticAndSmall?: boolean
isSocialMediaExport?: boolean
detailsMarkerInSvg?: DetailsMarker
}
7 changes: 4 additions & 3 deletions packages/@ourworldindata/grapher/src/header/Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@

h1 {
font-family: $serif-font-stack;
color: $gray-90;
margin: 0;
}

// title and subtitle
h1,
// subtitle
p {
color: $dark-text;
color: $light-text;
margin: 0;
}

Expand Down
16 changes: 13 additions & 3 deletions packages/@ourworldindata/grapher/src/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import {
GRAPHER_FRAME_PADDING_HORIZONTAL,
GRAPHER_FRAME_PADDING_VERTICAL,
} from "../core/GrapherConstants"
import { GRAPHER_DARK_TEXT } from "../color/ColorConstants"
import {
GRAPHER_DARK_TEXT,
GRAPHER_LIGHT_TEXT,
GRAY_90,
} from "../color/ColorConstants"

interface HeaderProps {
manager: HeaderManager
Expand Down Expand Up @@ -316,7 +320,11 @@ export class StaticHeader extends Header<StaticHeaderProps> {
rel="noopener"
>
{title.render(x, y, {
textProps: { fill: GRAPHER_DARK_TEXT },
textProps: {
fill: this.manager.isSocialMediaExport
? "#2d2e2d"
: GRAY_90,
},
})}
</a>
)}
Expand All @@ -330,7 +338,9 @@ export class StaticHeader extends Header<StaticHeaderProps> {
{
id: makeIdForHumanConsumption("subtitle"),
textProps: {
fill: manager.secondaryColorInStaticCharts,
fill: this.manager.isSocialMediaExport
? GRAPHER_DARK_TEXT
: GRAPHER_LIGHT_TEXT,
},
detailsMarker: this.manager.detailsMarkerInSvg,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface HeaderManager {
fontSize?: number
hideTitle?: boolean
hideSubtitle?: boolean
secondaryColorInStaticCharts?: string
isStaticAndSmall?: boolean
isSocialMediaExport?: boolean
detailsMarkerInSvg?: DetailsMarker
}

0 comments on commit b9167bd

Please sign in to comment.