Giter Site home page Giter Site logo

david-griffiths / nova-dark-theme Goto Github PK

View Code? Open in Web Editor NEW
72.0 3.0 11.0 31 KB

A dark theme for Laravel Nova

License: MIT License

CSS 8.10% PHP 65.13% Vue 17.56% JavaScript 7.96% HTML 1.24%
laravel laravelnova nova dark-theme theme css3 ui dashboard eye-care eye-strain

nova-dark-theme's Introduction

Nova Dark Theme

A dark theme for Laravel Nova to save your tired eyes ๐Ÿ‘€

Latest Stable Version Downloads License

Dark Theme Toggle Switch

Installation

First use composer to pull in the project:

composer require david-griffiths/nova-dark-theme

(Remember that you can install multiple themes with Nova. So you don't have to choose between this and another.)

Next you need to activate dark mode. To help you, there are several convenience commands included...

Add/Remove Toggle Switch From Menu

This is probably what you're looking for, as it lets you easily turn on dark mode at night.

toggle

php artisan nova-dark-theme:add-switch

If you've not made an over-writeable copy of Nova's user menu (the one in the top right), this command does that first of all. Then it adds the Vue component, which will look like this:

        <li>
            <nova-dark-theme-toggle
                label="{{ __('Dark Theme') }}"
            ></nova-dark-theme-toggle>
        </li>
    </ul>
</dropdown-menu>

To remove the switch from your menu, you could edit the file yourself, or run this:

php artisan nova-dark-theme:remove-switch

Set Dark Mode On/Off By Default

This can be used with the toggle switch or without it. If you're not using the toggle switch then when you set dark mode ON, it will stay on and not be changeable by users. If you are using the switch, then the below commands will only set the theme state when the page first loads. The user will then be able to flip the switch whenever they like.

php artisan nova-dark-theme:on

php artisan nova-dark-theme:off

These commands add or remove a css class called nova-dark-theme from the HTML tag in Nova's main layout template. Again, we copy this file to your resources directory (if you've not done so already) before making the change.

(:exclamation: You might need to run php artisan view:clear or php artisan view:cache before seeing the results)

How The CSS Works

We use a css filter to invert the colors, then some manual tweaks for the sidebar and logo areas. So white becomes black, which you should keep in mind when adding any custom css colors.

Code Fields

One item it doesn't style for you is the Nova Code field. I don't want impose a CodeMirror theme on you when you can pick one from here and set it like this:

Code::make('MyTextField')->options(['theme' => 'base16-light'])

(:exclamation: Remember to pick a light coloured CodeMirror theme if you want it to appear dark in Nova after the colors get inverted)

License

MIT License (MIT). Please see License File for more.

nova-dark-theme's People

Contributors

david-griffiths avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nova-dark-theme's Issues

Upgrading Nova.

Just found after updating Nova (2.9.*), the user settings menu disappeared. Nova git issues recommends to php artisan nova:publish --force. This removes the dark mode toggle. So we need to re-run php artisan nova-dark-theme:add-switch.

Just thought i'll flag.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.