跳到正文
Skillpedia
界面(UI/UX)48k · #4390

dark-mode

它能做什么

帮助你为网站和应用打造深色界面,使用深灰色而不是纯黑色。这样屏幕对眼睛更舒适,也更有现代感。

适用场景

  • ✓当你希望网站或应用看起来更现代、简洁时。
  • ✓在低光环境下减轻眼睛疲劳。
  • ✓设计需要更极简、更精致风格的时候。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/design-it/dark-mode/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/design-it/dark-mode/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“怎样让我的网站拥有好看又不累眼的深色主题?”

每周 5 个新技能,1 分钟读完。

工作原理

AI 会使用深灰色调代替纯黑色,并为重要元素使用较浅的色调。这样可以保证可读性和视觉舒适度,同时遵循深色模式的设计原则。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Dark Mode Design

"Not just inverted colors. A carefully constructed hierarchy of light on dark."

When to Use

Use this sub-style when the user's request matches the aesthetic described above. This is a child reference of the design-it skill and is not meant to be triggered directly.

Core Principles

  1. Never Pure Black: True #000000 causes smearing on OLED screens and extreme eye strain with white text. Use dark greys (e.g., #121212 or #0A0A0A).
  2. Elevation via Lightness: In light mode, shadows show elevation. In dark mode, shadows are invisible, so elevated surfaces must be lighter than the background.
  3. Desaturated Accents: Saturated colors vibrate painfully against dark backgrounds. Tone down the saturation of brand colors.

Visual DNA

  • Colors: Midnight Luxury or Minimalist Slate (inverted). Background #121212. Elevated cards #1E1E1E, #252525. Primary text #E1E1E1 (not #FFFFFF).
  • Typography: Standard highly readable sans-serifs, but often dropped down one font weight compared to light mode, as light text on dark backgrounds appears optically thicker.
  • Shadows: Pure black shadows, but with much lower opacity, mostly to separate slightly different shades of grey.

Web Implementation

  • CSS Example:
:root {
  --bg-base: #121212;
  --bg-elevated-1: #1E1E1E;
  --bg-elevated-2: #242424;
  --text-high-emphasis: rgba(255, 255, 255, 0.87);
  --text-medium-emphasis: rgba(255, 255, 255, 0.60);
  
  /* Accent color: Desaturated purple instead of bright purple */
  --accent-color: #BB86FC; 
}

body {
  background-color: var(--bg-base);
  color: var(--text-high-emphasis);
  font-weight: 300; /* Thinner weight for dark mode */
}

.dark-card {
  background-color: var(--bg-elevated-1);
  border-radius: 8px;
  padding: 24px;
  
  /* Very subtle border can help separate dark surfaces */
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.dark-card:hover {
  /* On hover, the element moves closer to the user, so it gets lighter */
  background-color: var(--bg-elevated-2);
}

.dark-btn {
  background-color: var(--accent-color);
  color: #000; /* Dark text on light accent is highly readable */
  font-weight: 600;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
}

App Implementation

SwiftUI

struct DarkModeView: View {
    // Force Dark Mode on this specific view (or use system settings)
    @Environment(\.colorScheme) var colorScheme
    
    var body: some View {
        ScrollView {
            VStack(spacing: 20) {
                // Primary elevated card
                VStack(alignment: .leading, spacing: 12) {
                    Text("Elevation via Lightness")
                        .font(.headline)
                        .foregroundColor(.primary) // Auto-adapts
                    Text("In dark mode, elevated surfaces are lighter grey, not shadowed.")
                        .font(.subheadline)
                        .foregroundColor(.secondary) // Auto-adapts
                }
                .padding()
                .frame(maxWidth: .infinity, alignment: .leading)
                // Use native semantic colors. .secondarySystemBackground is lighter than .systemBackground
                .background(Color(UIColor.secondarySystemBackground))
                .cornerRadius(12)
                
                // Desaturated Accent Button
                Button(action: {}) {
                    Text("Desaturated Accent")
                        .fontWeight(.semibold)
                        .foregroundColor(.black) // Dark text on light accent
                        .padding()
                        .frame(maxWidth: .infinity)
                        .background(Color(red: 0.73, green: 0.52, blue: 0.98)) // #BB86FC (Desaturated purple)
                        .cornerRadius(8)
                }
            }
            .padding()
        }
        // #121212 is the standard dark mode background, which systemBackground maps to closely
        .background(Color(UIColor.systemBackground))
    }
}
// .preferredColorScheme(.dark) to force
  • Rely on Semantics: SwiftUI's Color.primary, Color.secondary, Color(UIColor.systemBackground) and Color(UIColor.secondarySystemBackground) handle perfect dark mode transitions automatically.
  • Avoid forcing explicit hex codes for backgrounds unless you are building a custom-themed app.

Flutter

import 'package:flutter/material.dart';


…
常见问题

为什么不用纯黑色(#000000)?

纯黑配白色文字容易造成眼睛疲劳,在某些屏幕(OLED)上还会出现问题。使用 #121212 这类深灰色会更好。

深色背景下,元素怎样才能突出?

不靠阴影,而是对需要突出的元素(如卡片或按钮)使用较浅的灰色调。

鲜艳的颜色还适用吗?

在深色背景下,非常鲜艳的颜色会显得刺眼。建议使用饱和度较低(更柔和)的颜色版本,以保持整体和谐。

详情

作者的原始描述

Web and App implementation guide for Dark Mode Design. Trigger when user wants dark surfaces, reduced eye strain, and premium sleek aesthetics.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4390
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能