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

@hd-fe/theme

v0.5.13

Published

主题管理

Downloads

46

Readme

主题管理

本主题包提供 darkdarkNewlightlightNewdarkGencodarkGencoDatangdarkGencoYihai 主题。

只有 darkNewlightNew 主题提供了 variables.css

包目录

lib
-- darkNew
-- -- echarts
-- -- -- custom.json
-- -- -- theme.js
-- -- common.scss
-- -- index.css
-- -- variables.css
-- -- variables.scss
-- **

组件主题应用

调用接口时,会引入包括 element-ui @hd-fe/ui @hd-fe/business 组件库主题,并初始化 css 全局变量

单主题应用

// main.js
import ThemeClass from '@hd-fe/theme'
new ThemeClass({ themeName: 'darkNew' }).init()

多主题应用

主题切换时需要使用代码进行页面刷新,见下面示例代码

// utils/cookie.js
import cookie from 'js-cookie'

const THEME = 'app-theme' // 独立版THEME

export const getTheme = () => {
  return cookie.get(THEME)
}

export const setTheme = (theme) => {
  cookie.set(THEME, theme)
}
// main.js
import { getTheme } from '@/utils/cookie'
import ThemeClass from '@hd-fe/theme'
new ThemeClass({ themeName: (getTheme() || 'darkNew') }).init()
// vue
<template>
  <el-select
    v-model="theme"
    @change="selectTheme"
  >
    <el-option
      v-for="theme1 of themes"
      :key="theme1.name"
      :value="theme1.name"
      :label="theme1.title"
    />
  </el-select>
</template>
<script>
import { getTheme, setTheme } from '@/utils/cookie'

export default {
  data () {
    return {
      themes: [
        {
          name: 'lightNew',
          title: '亮色'
        },
        {
          name: 'darkNew',
          title: '暗黑'
        }
      ]
    }
  },
  methods: {
    selectTheme (name) {
      setTheme(name)
      location.reload()
    }
  }
}
</script>

引用主题配置颜色变量

// scss 变量
@import '~@hd-fe/theme/lib/dark/variables.scss'

echarts 图表主题应用

import HdECharts from '@hd-fe/echarts'
import theme from '@hd-fe/theme/lib/dark/echarts/theme.js'

Vue.use(HdECharts, { theme })

引用 echarts 中 legend.icon 等配置文件

import HdECharts from '@hd-fe/echarts'
import custom from '@hd-fe/theme/lib/dark/echarts/custom.json'
Vue.use(HdECharts, { custom })