npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

element-theme-darkplus

v2.1.4

Published

Element component dark theme base on the latest version 2.15.14.

Downloads

504

Readme

简体中文 | English

Introduction

The element-theme-darkplus is an Element component dark theme base on the latest version v2.15.14.

Sample

Install

npm i element-theme-darkplus -S

Import

// Webpack
import 'element-theme-darkplus/lib/index.css';

// CDN
<link rel="stylesheet" href="https://unpkg.com/element-theme-darkplus/lib/index.css">

Import on demand

// Webpack
import 'element-theme-darkplus/lib/input.css';

// CDN
<link rel="stylesheet" href="https://unpkg.com/element-theme-darkplus/lib/input.css">

Switch

If you have a chalk theme, a dark theme, two themes free to switch, then the following is best for you.

import 'element-ui/lib/theme-chalk/index.css';
import 'element-theme-darkplus/lib/index.color.css';

The official chalk theme theme-chalk includes component basic styles and chalk colors, while the dark theme element-theme-darkplus also includes component basic styles and dark colors. Importing both will result in redundant component basic styles. Therefore, we have provided an additional theme pack that only includes dark colors. The import method is very simple, just add a color suffix to the style file with the same name.

import `element-theme-darkplus/lib/index.color.css`;
import `element-theme-darkplus/lib/input.color.css`;

Advanced

The rating component Rate is special, with default values defined for color related props within the Element, and inline styles used in the template, resulting in external theme styles that cannot be overwritten.

| Props | Default | | --- | --- | | void-color | #c6d1de | | disabled-void-color | #eff2f7 | | text-color | #1f2d3d |

The transitive null value reset the corresponding props value for the subject to take effect.

<el-rate :value="3" show-text void-color="" text-color="" />

The progress bar component Progress is similar, only line progress bar are supported, and circle and dashboard shapes are not supported.

| Props | Default | | --- | --- | | define-back-color | #ebeef5 | | text-color | #606266 |

<el-progress :percentage="20" define-back-color="" text-color="" />

Although the two components can pass null values to reset properties to support dark themes, for students who are not concerned about this feature, it is unclear why properties such as text-color="" are passed in, which undoubtedly adds mental burden at the development level.

Um The style cannot solve the fundamental problem of Rate and Progress.

Can you redefine the Rate and Progress components? Without breaking the extensibility and uniqueness of the original component, adopted the method of inheriting the original component and make a middle layer in javascript to help the user initially empty the related colors props.

Import

import ElementUI from 'element-ui'
import Darken from 'element-theme-darkplus/utils/darken'

Vue.use(ElementUI)
Vue.use(Darken(ElementUI))

Import on demand

import { Progress, Rate } from 'element-ui'
import Darken from 'element-theme-darkplus/utils/darken'

Vue.component(Progress.name, Darken(Progress))// or Vue.use(Darken(Progress))
Vue.component(Rate.name, Darken(Rate))

CDN

<script src="https://unpkg.com/element-theme-darkplus/utils/darken.js"></script>

Problem

How to persist themes, update themes responsive to the system?

The theme switch in The preview page has added common dark theme functions, such as browser caching to permanently save the user's frequently used theme status, dynamically switching theme styles according to operating system presets, and media query style transition. You can refer to the component ThemeToggle or Sample.

Persistent loading for the first time in dark mode with white screen?

The reason is that the page has already been loaded, and the instance component only starts adding the dark class name to the DOM root element during the Vue lifecycle. However, before the loading time, it still defaults to the initial style, which will cause the page to white screen.

The solution is very simple. Add a script to the head in the html, which reads cache or operating system theme keywords before loading the page, and considers whether to add a dark class name to the root element of the DOM.

<script src="https://unpkg.com/element-theme-darkplus/utils/dark-mode.js"></script>

Support custom browser cache word key name.

<script src="https://unpkg.com/element-theme-darkplus/utils/dark-mode.js" storage-key="custom-theme-appearance"></script>