Posts Learn Snippets Categories Tags About
/

How to Enable Laravel Horizon Dark Mode

Learn how to enable Laravel horizon dark/night mode for better accessibility

Created on Jul 20, 2021

6 views

To enable Laravel Horizon dark/night mode you can define the config from the "HorizonServiceProvider" class. Inside the "boot" method you can uncomment the "Horizon::night()" and by doing so the dark mode will be enabled by default. Do note that this night mode is available for Horizon version 3 and above.
# app/Providers/HorizonServiceProvider.php

<?php

namespace App\Providers;

use Laravel\Horizon\Horizon;
use Illuminate\Support\Facades\Gate;
use Laravel\Horizon\HorizonApplicationServiceProvider;

class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
  public function boot()
  {
    parent::boot();
    Horizon::night();
  }

  /* other codes*/
}

Do note that if you recently just updated your horizon, do run the "horizon:publish" command to get the latest changes for the assets file.
php artisan horizon:publish

Created by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.