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

@tslsmart/theme-desktop

v2.2.0

Published

特斯联统一UI的主题库,需要配合Element-UI使用

Downloads

24

Readme

theme-desktop

简介

特斯联统一 UI 的桌面端的主题库,需要配合 Element-UI 或 者特斯联增强组件库使用

更新日志

点击阅读更新日志

开发说明

如果您仅是使用,请跳过. 参与开发前,请仔细阅 读开发说明

使用

安装

npm i @tslsmart/theme-desktop

引入

需要自行安装 element-ui 的依赖。

// 入口文件中

import ElementUI from "element-ui";
import "@tslsmart/theme-desktop"; // 重点,引入主题样式,这样可以使用一些通用变量

Vue.use(ElementUI);

其他主题

特斯联桌面主题库目前支持以下几种主题

| 主题 | 主色 | rgb 色值 | 英文名 | 备注 | | ------ | :-----: | ------------: | -------------: | --------------------- | | 云梦兰 | #6266ea | 98, 102, 234 | dribble-purple | 默认主题,无需额外处理 | | 凝夜紫 | #4C3776 | 76, 55, 118 | purple | - | | 宇鲜蓝 | #3776F3 | 55, 118, 243 | blue | - | | 靛燕蓝 | #2343EB | 35, 67, 235 | klein-blue | - | | 缙红螯 | #F15E2E | 241, 94, 46 | orange | - | | 漆墨黑 | #000000 | 0, 0, 0 | black | - | | 库盏金 | #B5996B | 181, 153, 107 | golden | - |

::: tip

除了默认主题外,在使用时你需要给你的body 标签加上 tsl-theme-${englishName}的 类名,例如:

:::demo

<!-- public/index.html中 -->
<body class="tsl-theme-orange">
  <el-tag>这是一个缙红螯的tag标签</el-tag>
</body>

:::

这样做的原因是弹窗之类的组件是插入到 body 中的,如果不将 css 变量插入到 body 中, 可能会存在样式问题

:::

动态切换主题

你可能还需要动态切换主题,我们在 @tslsmart/theme-desktop/themeList.js 中导出了所有的主题列表数组供你直接使用,你只需要动态地给body元素绑定类名就可以了。下面给出了案例的同时,给出了完整的主题的 label-value数组,以便你有选择地向用户提供主题模板。

:::demo

<div class="layout">
  <el-select v-model="activeTheme" @change="setTheme">
    <el-option
      v-for="item in themeList"
      :key="item.value"
      :label="item.label"
      :value="item.value"
    />
  </el-select>

  <el-tag>这是一个{{themeName}}主题的tag标签</el-tag>
</div>

<script>
  // import themeList from '@tslsmart/theme-desktop/themeList.js'
  // 你可以直接从themeList.js中导入完整的数组
  export default {
    data() {
      return {
        activeTheme: "dribble-purple",
        themeList: [
          {
            label: "云梦兰",
            value: "dribble-purple",
          },
          {
            label: "凝夜紫",
            value: "purple",
          },
          {
            label: "宇鲜蓝",
            value: "blue",
          },
          {
            label: "靛燕蓝",
            value: "klein-blue",
          },
          {
            label: "缙红螯",
            value: "orange",
          },
          {
            label: "漆墨黑",
            value: "black",
          },
          {
            label: "库盏金",
            value: "golden",
          },
        ],
      };
    },
    computed: {
      themeClass({ activeTheme }) {
        return "tsl-theme-" + activeTheme;
      },
      themeName({ activeTheme, themeList }) {
        const theme = themeList.find((each) => each.value === activeTheme);
        return theme.label;
      },
    },
    methods: {
      setTheme() {
        document.body.className = this.themeClass;
      },
    },
  };
</script>

:::

项目结构

theme-desktop
├── README.md
├── lib // css文件输出目录
├── src // scss文件输出目录
├── themeList.js  // 主题列表数组
└── package.json