Skip to content

davidskelly/flutter_system_theme

 
 

Repository files navigation

system_theme

A flutter plugin to get the current system theme information

Supported platforms

Feature Android iOS Web MacOs Windows Linux
Get accent color ✔️ ✔️ ✔️
Get dark mode ✔️ ✔️ ✔️ ✔️ ✔️

Usage

Import it:

import 'package:system_theme/system_theme.dart';

Get system accent color

Use the getter SystemTheme.accentInstance.accent to get the system accent color.

final accentColor = SystemTheme.accentInstance.accent;

To reload the accent colors, use the method load():

await SystemTheme.accentInstance.load();

You can load the colors on main, so the colors can't be wrong at runtime:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await SystemTheme.accentInstance.load();
  runApp(MyApp());
}

Check dark mode

Use the getter SystemTheme.isDarkMode to check if the device is in dark mode.

final darkMode = SystemTheme.darkMode;

Contribution

Feel free to open an issue if you find an error or make pull requests.

Acknowlegments

About

A flutter plugin to get the current system theme info

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 46.7%
  • C++ 23.6%
  • Kotlin 18.0%
  • CMake 8.7%
  • C 3.0%