Skip to main content

hue_rotation 3.0.0 copy "hue_rotation: ^3.0.0" to clipboard
hue_rotation: ^3.0.0 copied to clipboard

Change the color of any widget that has a color. Like SwiftUI's Hue Rotation.

hue_rotation #

Apply a hue rotation to any Flutter widget subtree using a color matrix.

Installation #

Flutter 3.47+

dependencies:
  hue_rotation: ^3.0.0

Flutter 3.10–<3.47

dependencies:
  hue_rotation: ^2.0.2

Usage #

import 'package:flutter/widgets.dart';
import 'package:hue_rotation/hue_rotation.dart';

const HueRotation(
  degrees: 90,
  child: SizedBox(
    width: 64,
    height: 64,
    child: ColoredBox(color: Color(0xff2196f3)),
  ),
)

degrees accepts positive, negative, and fractional angles. Zero and full turns leave colors unchanged. Alpha is preserved. A half-turn (180) uses the hue rotation matrix; it is not RGB inversion or an HSV hue adjustment. Output channels outside the display gamut are clamped, so brightness and saturation can appear different.

Update degrees from an animation to animate the filter. See the example for static and animated rotations of Colors.blue.

Upgrading to 3.0.0 #

The widget API is unchanged. Mobile host apps follow Flutter’s minimums (iOS 15 and Android API 24 on Flutter 3.47), or any higher minimum required by the app.

HueRotation in action #

Hue rotation preview Animated hue rotation

29
likes
160
points
433
downloads

Documentation

API reference

Publisher

verified publisherachim.io

Weekly Downloads

Change the color of any widget that has a color. Like SwiftUI's Hue Rotation.

Repository (GitHub)
View/report issues

Topics

#animation #hue #color #ui

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on hue_rotation