-
Notifications
You must be signed in to change notification settings - Fork 30
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
RFC: Apps Dark Mode Support #7734
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -580,6 +580,9 @@ export const StandardLayout = (props: WebProps | AppProps) => { | |
hasStarRating={ | ||
typeof article.starRating === 'number' | ||
} | ||
supportsDarkMode={ | ||
renderingTarget === 'Apps' | ||
} | ||
Comment on lines
+583
to
+585
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than deciding this at the layout level, then passing |
||
/> | ||
</div> | ||
</GridItem> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ import { | |
// Here is the one place where we use `pillarPalette` | ||
import { pillarPalette_DO_NOT_USE as pillarPalette } from '../../lib/pillars'; | ||
import type { DCRContainerPalette } from '../../types/front'; | ||
import type { Palette } from '../../types/palette'; | ||
import type { DarkPaletteColours, Palette } from '../../types/palette'; | ||
import { decideContainerOverrides } from './decideContainerOverrides'; | ||
import { transparentColour } from './transparentColour'; | ||
|
||
|
@@ -51,6 +51,10 @@ const blogsGrayBackgroundPalette = (format: ArticleFormat): string => { | |
} | ||
}; | ||
|
||
const textHeadlineDark = (_format: ArticleFormat): string => { | ||
return 'orangered'; | ||
}; | ||
|
||
const textHeadline = (format: ArticleFormat): string => { | ||
switch (format.display) { | ||
case ArticleDisplay.Immersive: | ||
|
@@ -2049,13 +2053,22 @@ const hoverPagination = (format: ArticleFormat) => { | |
} | ||
}; | ||
|
||
const decidePaletteDark = (format: ArticleFormat): DarkPaletteColours => { | ||
return { | ||
text: { | ||
headline: textHeadlineDark(format), | ||
}, | ||
}; | ||
}; | ||
|
||
export const decidePalette = ( | ||
format: ArticleFormat, | ||
containerPalette?: DCRContainerPalette, | ||
): Palette => { | ||
const overrides = | ||
containerPalette && decideContainerOverrides(containerPalette); | ||
return { | ||
dark: decidePaletteDark(format), | ||
text: { | ||
Comment on lines
+2071
to
2072
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be a big change but I'd be very open to moving the existing properties into a palette.light, instead of having them at the top level, that way the palette structure is {
light: { text: { ... } },
dark: { text: { ... } }.
} It'd be a lot of files to change so worth doing in another PR, but I think this would make it really clear that we support both light & dark mode when working on the project, and also lay the groundwork for expansion to support dark mode on the site in the future! |
||
headline: textHeadline(format), | ||
headlineWhenMatch: textHeadlineWhenMatch(format), | ||
|
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.
Could this live in its own file?