-
Notifications
You must be signed in to change notification settings - Fork 521
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
render: support dark themes #613
Conversation
whoa very cool! can you create issues for what's blocking dark themes? they should be minor changes that i'd be happy to make to unblock @vfosnar |
Thanks! Made the issue, think I covered everything but let me know if I missed something. |
Hi, had some free time today so I tried to fix #619 and think it is working now. I also added LightDark |
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.
can you add some tests of shapes with varying fill for sketch mode to see the overlay stuff?
https://github.com/terrastruct/d2/blob/master/d2renderers/d2sketch/sketch_test.go
Will look into that |
Never wrote tests in Go or like unit tests in general so sorry for any misunderstanding from my side:( |
Also a note for myself because I left some colors unimplemented and it looks like they really should have been implemented :D |
the sketched overlays look good. would it be possible to split that into its own PR or is it intertwined? i'd be ready to merge that, whereas this one might take some more review and discussion. |
Sadly no, it heavily depends on the new implementation of theming. That's why it was one of the last things on my TODO |
gotcha. okay, looking forward to reviewing, feel free to request when it's ready! |
stylish! |
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.
@bo-ku-ra is our stress-tester 😄 |
Is that video wrong? |
thanks!
that todo was meant more like "we should follow a convention but won't break if we don't" I will investigate this when I get to a computer
think this was intentional cuz the hardcoded values looked meh with a dark theme |
fixed. it was a small typo :p |
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.
@vfosnar awesome i think this is good to go then! can you squash your commits and then add a changelog line?
@alixander alright! |
@alixander welp, it throws some error...
can't I just update the changelog and you will merge squash it? |
@vfosnar we have squash merges turned off for some reason of CI I don't remember. you don't have to update the changelog, but squashing 60 commits down would be good |
I understand that, but when I run
It throws
and when I do as it says and resolve it, it throws the same error on another file |
@vfosnar oh, yeah that's annoying, idk what to do when i hit those either. can you give this a shot? https://stackoverflow.com/questions/25356810/git-how-to-squash-all-commits-on-branch |
Okayy, looks like I'm really bad at git. Dunno how to make this work with a fork, maybe you could try merging it yourself? https://www.baeldung.com/ops/git-squash-commits#squashing-by-merging-with-the---squash-option |
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.
alright, sorry for that
fixed! I did notice this but I thought it was current behavior and needs to be fixed in the future #613 (comment) |
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.
thank you too for you cooperation and for this awesome project! |
super excited for this!!! thanks @vfosnar |
case colorString[0:2] == "AB": | ||
switch colorString[2] { | ||
case '4', '5': | ||
return AB4, nil | ||
} |
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.
@vfosnar i just realized, is there a reason why 4 and 5 are aggregated here?
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.
i'm assuming it's a mistake (even though the code here looks deliberate). fixed here: #883
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.
Well, AFAIR this code should shift any given theme color to the next one and when it was the first one, it will return itself. Thus if we have 2 colors, we return same color in both cases.
This whole shifting code was intended more like a "somewhat working" solution and I thought I left a TODO explaining it somewhere there and that a better solution may be available but would probably require adding all rn missing colors to themes and tweaking them a little.
also I think this method does the opposite in dark mode, it lightens the value, becase dark themes have flipped pallet.
reference to why I thought shifting could work:
https://github.com/terrastruct/d2/tree/master/d2themes#color-coding-example
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.
oh shoot yeah i didn't look at the function name, this makes sense. hmmm, will think about 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.
|
||
// Alternative colors B | ||
AB4 = "AB4" | ||
AB5 = "AB4" |
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.
is this intentional?
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.
oh, no it's not.
Hey, I tried to create my own dark theme, but I found out there is no way to change the background. There was also hardcoded foreground color for arrow labels so I changed it to N1 (Text).
I added colors from the Cattpuccin Mocha Mauve color scheme for testing and because it looks really nice.
Some things are still missing, Latex and code blocks render horribly, but I just wanted to share my changes. What do you all think about this?
What is working
And what is not AFAIK