定制 awcodes/light-switch 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

awcodes/light-switch

最新稳定版本:v2.0.2

Composer 安装命令:

composer require awcodes/light-switch

包简介

Plugin to add theme switching (light/dark/system) to the auth pages for Filament Panels

README 文档

README

light switch screenshots Latest Version on Packagist Total Downloads

Light Switch

Plugin to add theme switching (light/dark/system) to the auth pages for Filament Panels

Compatibility

Package Version Filament Version
1.x 3.x
2.x 4.x

Installation

You can install the package via composer:

composer require awcodes/light-switch

Important

If you have not set up a custom theme and are using Filament Panels follow the instructions in the Filament Docs first.

After setting up a custom theme add the plugin's views to your theme css file or your app's css file if using the standalone packages.

@source '../../../../vendor/awcodes/light-switch/resources/**/*.blade.php';

Usage

use Awcodes\LightSwitch\LightSwitchPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            LightSwitchPlugin::make(),
        ]);
}

Position

By default, the switcher will be added to the top right of the auth pages. You can change this by passing one of the Alignment enums cases to the position() method.

use Awcodes\LightSwitch\LightSwitchPlugin;
use Awcodes\LightSwitch\Enums\Alignment;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            LightSwitchPlugin::make()
                ->position(Alignment::BottomCenter),
        ]);
}

Disabling on specific pages

You can disable the switcher on specific pages by passing an array of route strings to the on() method. Anything in this array will get evaluated as should be shown. Otherwise, it will be enabled on all auth pages available to your panel.

When determining if the switcher should be shown the Str::contains() method is used to match the route name, so you can pass a partial route string to match multiple pages and not have to pass the complete route name. This is useful if you need to target routes containing a specific panel route, like admin.auth.email or app.auth.email.

use Awcodes\LightSwitch\LightSwitchPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            LightSwitchPlugin::make()
                ->enabledOn([
                    'auth.email',
                    'auth.login',
                    'auth.password',
                    'auth.profile',
                    'auth.register',
                ]),
        ]);
}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

  • 总下载量: 75.97k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 45
  • 点击次数: 3
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 45
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固