Skip to content
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

Opt-in dark mode support #1209

Merged
merged 3 commits into from
Jan 16, 2023
Merged

Opt-in dark mode support #1209

merged 3 commits into from
Jan 16, 2023

Conversation

fotrino
Copy link
Contributor

@fotrino fotrino commented Jan 2, 2023

This PR introduces opt-in dark mode support to Jetstream, borrowed from @jessarcher PR on Breeze

php artisan jetstream:install {stack} --dark

Following the previous mentioned PR, the dark mode classes will be stripped unless dark mode is enabled.
When installing livewire stack without dark mode, the components will be published in order to strip the dark classes from them.

Screenshots

Light Dark
register-light register-dark
tos-light tos-dark
privacy-policy-light privacy-policy-light dark
login-light login-dark
reset-password-light reset-password-dark
dashboard-light dashboard-dark
profile-light profile-dark
confirm-password-modal-light confirm-password-modal-dark
log-out-sessions-light log-out-sessions-dark
delete-account-light delete-account-dark
create-team-light create-team-dark
edit-team-light edit-team-dark
delete-team-member-light delete-team-member-dark
delete-team-light delete-team-dark
manage-role-light manage-role-dark
api-tokens-light api-tokens-dark
token-confirmation-light token-confirmation-dark
token-delete-light token-delete-dark
edit-token-light edit-token-dark
active-user-menu-light active-user-menu-dark
team-menu-light team-menu-dark
focus-menu-button-light focus-menu-button-dark
responsive-menu-light responsive-menu-dark

Notes

  • I copied the styles of inputs & buttons from Breeze PR, which will change colors from blue to indigo, happy to change back all to blue if this presents a problem.
  • I used Livewire stack as a basis and then copied to Vue, while doing this I found minor inconsistencies between the stacks which are now improved. This includes the caret icon in the user's dropdown and some minor visual differences - keep this in mind when reviewing the diff.
  • I've included the fix focus styling in this and included the dark mode options.

@taylorotwell
Copy link
Member

Thanks for looking into this. It feels like we may want to address this issue of the black text on dark background in the logo before merging?

image

@fotrino
Copy link
Contributor Author

fotrino commented Jan 9, 2023

Great idea! Just updated to use the dark-mode compatible logo in the repo art.

Light Dark
Screenshot 2023-01-09 at 8 23 18 AM Screenshot 2023-01-09 at 8 23 06 AM

@driesvints
Copy link
Member

@fotrino thanks but looks a bit awkward. Can't we make it so it has completely white letters and no border on the icon?

@driesvints
Copy link
Member

Might need to duplicate the SVG logo

@fotrino
Copy link
Contributor Author

fotrino commented Jan 9, 2023

@driesvints thanks for the input, also thought it was a bit off but was trying to follow the existing SVG.
I came up with another solution, use fill classes on the SVG. Let me know what you think about it.

Light Dark
Screen Shot 2023-01-09 at 10 34 56 AM Screen Shot 2023-01-09 at 10 35 02 AM

@driesvints
Copy link
Member

Looks much better!

@n1crack
Copy link
Contributor

n1crack commented Jan 9, 2023

Nice one, I hope it releases soon .. I have tried dark mode myself before but it wasn't good enough. here is the version of mine :)

image

@fotrino
Copy link
Contributor Author

fotrino commented Jan 10, 2023

@driesvints the SVG are updated. Please let me know if there is anything else that needs to be looked into :)

@taylorotwell taylorotwell merged commit dcc3f9f into laravel:2.x Jan 16, 2023
@taylorotwell
Copy link
Member

Thanks!

@driesvints
Copy link
Member

Thanks @fotrino!

@ziming
Copy link

ziming commented Jan 18, 2023

I installed jetstream months ago, this morning I did a composer update. I never ran any jetstream:install --dark command

Tonight my sites suddenly look weird with some parts in dark and some parts in white.

It looks like this dark mode is not really opt in after all.

Screenshot attached, hope it helps. I do like dark mode a lot but perhaps it is not ready yet

CleanShot 2023-01-18 at 20 28 02

CleanShot 2023-01-18 at 20 31 49

@taylorotwell
Copy link
Member

This will have to be reverted.

jessarcher added a commit that referenced this pull request Jan 18, 2023
taylorotwell pushed a commit that referenced this pull request Jan 18, 2023
* Revert "[2.x] Strip dark classes from welcome component when dark mode isn't selected. (#1224)"

This reverts commit 2ed280e.

* Revert "wip"

This reverts commit 1965e32.

* Revert "Opt-in dark mode support  (#1209)"

This reverts commit dcc3f9f.
@fotrino fotrino mentioned this pull request Jan 19, 2023
@dah-HUB
Copy link

dah-HUB commented Mar 20, 2023

Hi there,
Please how to enable/disable dark mode programmatically ?
Thanks

@jessarcher
Copy link
Member

Hi there, Please how to enable/disable dark mode programmatically ? Thanks

Jetstream uses Tailwind to handle dark mode. The Tailwind docs have a section on manually toggling dark mode at https://tailwindcss.com/docs/dark-mode#toggling-dark-mode-manually.

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.

7 participants