-
Notifications
You must be signed in to change notification settings - Fork 338
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
Add darkly-pureblack
theme
#1610
Conversation
The only thing I noticed that's broken is the dropdown icon. I'd love to get some more eyeballs on this. |
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.
Just tested and it looks beautiful.
The dropdown's and icons all look fine to me.
Which dropdown icon? How is it broken? |
The down carot icon, I believe it’s implemented via |
Forgot to mention that it’s broken because the color matches the background color of the select field, rendering it invisible. |
Fixed it, @dessalines @jsit. The down carot icon is now subtle but visible. |
Which down caret icon? The post actions dropdown? Can you attach a screenshot? I wonder if we could handle this differently so that it better adapts to different colorschemes. |
Oh, in "select a community"? |
@jsit This one: I'm pretty sure it's shared across all dropdown selects. |
Hm, I think there might be a way around this. Hold please. |
So, Bootstrap can change the background image on certain elements by looking for If you really want, you can add something like this to <div id="app"
data-bs-theme={
user &&
["darkly", "darkly-red", "darkly-pureblack"].includes(
user.local_user_view.local_user.theme
)
? "dark"
: "light"
}
> |
Or you could try: <div id="app"
data-bs-theme={
(window.matchMedia("(prefers-color-scheme: dark)") && user?.local_user_view.local_user.theme == 'browser') ||
(user &&
["darkly", "darkly-red", "darkly-pureblack"].includes(
user.local_user_view.local_user.theme
))
? "dark"
: "light"
}
> But |
Likely because it renders on both the server and the client. |
Check this out:
export class App extends Component<any, any> {
private isoData: IsoDataOptionalSite = setIsoData(this.context);
private readonly mainContentRef: RefObject<HTMLElement>;
constructor(props: any, context: any) {
super(props, context);
this.mainContentRef = createRef();
}
get isDark() {
return (
isBrowser() && window.matchMedia("(prefers-color-scheme: dark)").matches
);
}
handleJumpToContent(event) {
event.preventDefault();
this.mainContentRef.current?.focus();
}
render() {
const siteRes = this.isoData.site_res;
const siteView = siteRes?.site_view;
const user = UserService.Instance.myUserInfo;
return (
<>
<Provider i18next={I18NextService.i18n}>
<div
id="app"
className="lemmy-site"
data-test={user?.local_user_view.local_user.theme}
data-bs-theme={
(this.isDark &&
user?.local_user_view.local_user.theme === "browser") ||
(user &&
["darkly", "darkly-red", "darkly-pureblack"].includes(
user.local_user_view.local_user.theme
))
? "dark"
: "light"
}
> |
I think we could extract the logic for determining to use theme light or dark into a function. It shouldn't even need to reference the App component. |
Oh for sure, I was just throwing it in there to demo it |
I say we merge this and do more fine-tuning in the 0.18.2 release instead, maybe after getting additional feedback from users. |
Hi Lemdevs!
In this PR:
darkly-pureblack
theme intended for OLED displaysThanks!