system_theme 패키지는 Android, iOS, Web, macOS, Windows, Linux를 포함한 여러 플랫폼에서 시스템의 강조 색상에 액세스하고 반응할 수 있도록 해줍니다. 현재 시스템 강조 색상을 가져오고 변경 사항을 감지하는 간단한 방법을 제공하여 디바이스 레벨 테마와 앱 UI의 일관성을 높입니다. 수동 테마 관리 없이 네이티브 시스템 미학을 따르려는 앱에 이상적입니다.
사용 사례
앱 UI에서 시스템 강조 색상 일치
시스템 설정을 기반으로 동적 테마 만들기
네이티브한 외관과 느낌으로 크로스 플랫폼 앱 만들기
시스템 테마가 변경될 때 색상이 자동으로 업데이트됩니다
시스템 정의 색상 테마를 통한 접근성 향상
주요 기능
시스템 강조 색상 변경 실시간 듣기
모든 주요 운영 체제에 대한 크로스 플랫폼 지원
현재 강조 색상을 검색하는 간단한 API
시스템 테마가 변경될 때 자동 업데이트
경량이고 통합하기 쉬움
적합한 대상
네이티브에 가까운 UI를 목표로 하는 개발자
동적 테마 적응이 필요한 앱
접근성과 사용자 경험에 중점을 둔 프로젝트
크로스 플랫폼 플러터 애플리케이션
원활한 시스템 통합을 원하는 디자이너
고려 사항
강조 색상에 제한됨; 전체 테마 모드를 관리하지 않음
플랫폼 간에 동작이 약간 다를 수 있습니다
일부 OS에서는 플랫폼별 권한이 필요합니다
강조 색상 이상의 복잡한 테마 관리에는 적합하지 않습니다
시스템 수준의 색상 사용 가능 여부에 따라 다릅니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
system_theme
A flutter plugin to retrieve the current system theme information
Supported platforms
Platform
Accent Color
Listen to Color Changes
Minimum Version
Android
✔️
Android 10+
iOS
✔️
iOS 14+
Windows
✔️
✔️
Windows 10+
macOS
✔️
✔️
Mojave 10.14+
Linux
✔️
GTK 3+
Web
✔️
All modern browsers
Usage
Import it:
import'package:system_theme/system_theme.dart';
Get system accent color
Use the getter SystemTheme.accentColor.accent to get the accent color.
final accentColor = SystemTheme.accentColor.accent;
To reload the accent colors, use the method load():
awaitSystemTheme.accentColor.load();
You can load the colors before running the app, so the colors can't be wrong at runtime:
To avoid unexpected outcomes at runtime, it's recommended to configure your own fallback color. The fallback color is used if the system is not able to provide the color.
On iOS 14 and later, this is the application's SwiftUI accent color (for
example, the accent configured in the app's asset catalog), or the platform's
app-level default when none is configured. Unlike Windows and macOS, iOS does
not expose an equivalent global user-selected system accent color. If the app
accent is unavailable or cannot be converted, the existing fallback or last
loaded palette is retained. iOS does not automatically report accent changes;
call load() to refresh it.
Contribution
See native testing for platform test commands and manual verification steps.