dark-mode – skill Thiết kế & UI cho agent AI
Hướng dẫn triển khai Web và App cho Dark Mode Design. Kích hoạt khi người dùng muốn bề mặt tối, giảm mỏi mắt và thẩm mỹ sang trọng, tinh gọn.
Cài skill dark-mode bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/dark-mode-f859e.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /dark-mode – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/dark-mode-f859e.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $dark-mode – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/dark-mode-f859e.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /dark-mode – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/dark-mode-f859e.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /dark-mode – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
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. Choose Surface Colors: Black and dark grey are both valid. OLED artifacts depend on the display; comfort depends on the user and lighting. Offer theme choice and test contrast.
2. Elevation via Lightness: Lighter surfaces and borders can clarify layers when shadows are subtle. Shadows are not universally invisible in dark mode.
3. Test Accents: Choose accent saturation for readable text and clear state indicators; avoid universal claims about discomfort.
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: 400; /* Preserve readable body weight; test with users. */
}
.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()
}
// Semantic systemBackground follows platform appearance; dark iOS may use black.
.background(Color(UIColor.systemBackground))
}
}
// .preferredColorScheme(.dark) to force- Rely on Semantics: SwiftUI's
Color.primary,Color.secondary,Color(UIColor.systemBackground)andColor(UIColor.secondarySystemBackground)adapt to platform appearance; verify custom combinations and increased-contrast settings. - Avoid forcing explicit hex codes for backgrounds unless you are building a custom-themed app.
Flutter
import 'package:flutter/material.dart';
class DarkModeApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// Configure the Dark Theme
themeMode: ThemeMode.dark,
darkTheme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: const Color(0xFF121212), // Standard dark background
cardColor: const Color(0xFF1E1E1E), // Elevated surface
colorScheme: const ColorScheme.dark().copyWith(
primary: const Color(0xFFBB86FC), // Desaturated accent
onPrimary: Colors.black, // Dark text on light accent
surface: const Color(0xFF1E1E1E),
),
),
home: Scaffold(
appBar: AppBar(title: const Text('Dark Mode', style: TextStyle(color: Colors.white70))),
body: ListView(
padding: const EdgeInsets.all(16),
children: [
Card(
elevation: 0, // Shadows don't show well anyway
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(color: Colors.white.withOpacity(0.05)), // Subtle border
),
child: const Padding(
padding: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Elevation via Lightness', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
SizedBox(height: 8),
Text('Elevated surfaces use lighter greys.', style: TextStyle(color: Colors.white60)),
],
),
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {},
child: const Text('Desaturated Accent'),
),
],
),
),
);
}
}- When using
ThemeData.dark(), actively overridescaffoldBackgroundColorto#121212andcardColorto#1E1E1E. - Ensure your
colorScheme.onPrimaryis black so text is readable when placed on top of your desaturated primary accent button.
React Native
import { useColorScheme } from 'react-native';
const DarkModeScreen = () => {
const isDark = useColorScheme() === 'dark';
// Custom dark theme dictionary
const theme = {
bgBase: isDark ? '#121212' : '#FFFFFF',
bgElevated: isDark ? '#1E1E1E' : '#F5F5F5',
textHigh: isDark ? 'rgba(255, 255, 255, 0.87)' : 'rgba(0, 0, 0, 0.87)',
textMedium: isDark ? 'rgba(255, 255, 255, 0.60)' : 'rgba(0, 0, 0, 0.60)',
accent: isDark ? '#BB86FC' : '#6200EE', // Desaturated for dark, vibrant for light
onAccent: isDark ? '#000' : '#FFF',
};
return (
<View style={{ flex: 1, backgroundColor: theme.bgBase, padding: 16 }}>
<View style={{
backgroundColor: theme.bgElevated,
padding: 24,
borderRadius: 12,
borderWidth: isDark ? 1 : 0,
borderColor: 'rgba(255,255,255,0.05)',
marginBottom: 20
}}>
<Text style={{ color: theme.textHigh, fontSize: 18, fontWeight: 'bold', marginBottom: 8 }}>
Elevation via Lightness
</Text>
<Text style={{ color: theme.textMedium }}>
Elevated surfaces use lighter greys.
</Text>
</View>
<TouchableOpacity style={{
backgroundColor: theme.accent,
padding: 16,
borderRadius: 8,
alignItems: 'center'
}}>
<Text style={{ color: theme.onAccent, fontWeight: 'bold' }}>Desaturated Accent</Text>
</TouchableOpacity>
</View>
);
};- Rely on
useColorScheme()hook from React Native. - Define a strict dictionary of your color tokens. Notice how
theme.accentshifts from a vibrant purple (#6200EE) in light mode to a desaturated pastel purple (#BB86FC) in dark mode.
Jetpack Compose
@Composable
fun DarkModeScreen() {
// Typically this logic lives in your Theme.kt
val darkColors = darkColorScheme(
background = Color(0xFF121212),
surface = Color(0xFF1E1E1E),
primary = Color(0xFFBB86FC),
onPrimary = Color.Black,
onBackground = Color.White.copy(alpha = 0.87f),
onSurface = Color.White.copy(alpha = 0.87f)
)
MaterialTheme(colorScheme = darkColors) {
Column(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.color… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- dashboard-design – Hướng dẫn triển khai Web và App cho Dashboard Design. Kích hoạt khi người dùng muốn bố…
- data-dense-design – Hướng dẫn triển khai Web và App cho Data-Dense Design. Kích hoạt khi người dùng muốn…
- database-design – Nguyên tắc và ra quyết định thiết kế cơ sở dữ liệu. Thiết kế schema, chiến lược index…
- segment-anything-model – SAM: phân đoạn ảnh zero-shot qua điểm, hộp và mặt nạ.
- ddd-strategic-design – Thiết kế các artifact chiến lược DDD gồm subdomain, bounded context và ngôn ngữ chung…
- visual-recon – Chụp ảnh màn hình tất cả host đang hoạt động để phân loại trực quan nhanh và nhận diện…
- observability-designer – Thiết kế chiến lược observability sẵn sàng cho production, kết hợp metrics, logs và…
- design-it – Định tuyến các tác vụ thiết kế frontend đến 48 phong cách UI cụ thể. Kích hoạt khi yêu…