A Flutter color palette with eyedropper, HSL, RGB and Material colors

Overview

Cyclop Pub Version

Cyclop logo

A flutter colorpicker with an eyedropper tool. Works on mobile, desktop & web ( CanvasKit)

Demo

Desktop & tablet Mobile
Cyclop desktop eyedropper Cyclop onmobile
Material HSL RVB Custom
Cyclop material Cyclop hsl Cyclop hsl Cyclop hsl
Light theme Dark theme
Cyclop light Cyclop dark

Eyedropper

Select a color from your Flutter mobile or desktop screen.

Cyclop eye dropper

To use the eyedropper you need to wrap the app in the EyeDrop widget.

@override
  Widget build(BuildContext context) {
    return EyeDrop(
      child: Builder(
        builder: (context) => Scaffold(
          backgroundColor: backgroundColor,
          body: Container(
            child: ColorButton(
              key: Key('c1'),
              color: color1,
              config: ColorPickerConfig(enableEyePicker = true),
              size: 32,
              elevation: 5,
              boxShape: BoxShape.rectangle, // default : circle
              swatches: swatches,
              onColorChanged: (value) => setState(() => color1 = value),
            ),
          ),
        ),
      ),
    );
  }

Customisable

  • disable opacity slider
  • disable eye dropping
  • disable swatch library
  • Circle or Square color buttons
ColorButton(
  key: Key('c1'),
  color: color1,
  config: ColorPickerConfig(
    this.enableOpacity = true,
    this.enableLibrary = false,
    this.enableEyePicker = true,
  ),
  boxShape: BoxShape.rectangle, // default : circle
  size: 32,
  swatches: swatches,
  onColorChanged: (value) => setState( () => color1 = value ),
 );

ColorButton(
  key: Key('c2'),
  color: color2,
  config: ColorPickerConfig(enableEyePicker: false),
  size: 64,
  swatches: swatches,
  onColorChanged: (value) => setState( () => color2 = value ),
  onSwatchesChanged: (newSwatches) => setState(() => swatches = newSwatches),
 );
Comments
  • Using ColorPicker without ColorButton

    Using ColorPicker without ColorButton

    In my drawing app, the user can tap on a field to change its color. This invokes an AlertDialog:

    showDialog(
            context: context,
            builder: (context) {
              return SingleChildScrollView(
                child: AlertDialog(
                  title: const Text('Pick a color!'),
                  content: ColorPicker(
                    color: oldColor,
                    onChanged: (value){
                      chosenColor = value;
                    },
                  actions: <Widget>[
                    Row(
                      children: [
                        TextButton(
                          child: const Text('Cancel'),
                          onPressed: () {
                            Navigator.of(context).pop();
                          },
                        ),
                        TextButton(
                          child: const Text('Save'),
                          onPressed: () {
                            artFields[fieldNo].fieldColor = chosenColor;
                            setState(() {});
                            Navigator.of(context).pop();
                          },
                        ),
                      ],
                    ),
                  ],
                ),
              );
            });
    

    I cannot use ColorButton for this. I tried to use your version of ColorPicker but the results are strange (e.g. only some sliders react to taps and the rectangle at the bottom does not change color). I suppose using your ColorPicker directly this way is not supported? Should I give up on cyclop?

    opened by BoHellgren 1
  • Eye Drop Picker is not moving

    Eye Drop Picker is not moving

    Hii there I have cloned your repo but eyedropper is not working it's not moving anywhere.

    My Flutter Version is Flutter 1.22.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 84f3d28555 (4 weeks ago) • 2020-10-15 16:26:19 -0700 Engine • revision b8752bbfff Tools • Dart 2.10.2

    I am getting this kind of error when I click on the eyedropper button

    I/flutter ( 1694): repaintBoundaryToImage... 'package:flutter/src/rendering/proxy_box.dart': Failed assertion: line 2958 pos 12: '!debugNeedsPaint': is not true.
    I/flutter ( 1694): repaintBoundaryToImage... 'package:flutter/src/rendering/proxy_box.dart': Failed assertion: line 2958 pos 12: '!debugNeedsPaint': is not true.
    

    and eye picker from the dialog is not Moving and I can not even touch it.

    WhatsApp Image 2020-11-12 at 10 57 09 PM

    I have also tried putting the Builder on the scaffold but it's not working.

    Here is My Modified Code from your Code.

    import 'package:cyclop/cyclop.dart';
    import 'package:flutter/cupertino.dart';
    import 'package:flutter/foundation.dart';
    import 'package:flutter/material.dart';
    
    void main() async {
      runApp(App());
    }
    
    class App extends StatelessWidget {
      @override
      Widget build(BuildContext context) => MaterialApp(
            home: EyeDrop(child: MainScreen()),
            debugShowCheckedModeBanner: false,
          );
    }
    
    class MainScreen extends StatefulWidget {
      @override
      _MainScreenState createState() => _MainScreenState();
    }
    
    class _MainScreenState extends State<MainScreen> {
      Color appbarColor = Colors.blueGrey;
    
      Color backgroundColor = Colors.grey.shade200;
    
      Set<Color> swatches = Colors.primaries.map((e) => Color(e.value)).toSet();
    
      @override
      Widget build(BuildContext context) {
        final textTheme = Theme.of(context).textTheme;
    
        final bodyTextColor =
            ThemeData.estimateBrightnessForColor(backgroundColor) == Brightness.dark
                ? Colors.white70
                : Colors.black87;
    
        final appbarTextColor =
            ThemeData.estimateBrightnessForColor(appbarColor) == Brightness.dark
                ? Colors.white70
                : Colors.black87;
    
        return Builder(
            builder: (context) => Scaffold(
                  backgroundColor: backgroundColor,
                  appBar: AppBar(
                    title: Text('Cyclop Demo',
                        style:
                            textTheme.headline6.copyWith(color: appbarTextColor)),
                    backgroundColor: appbarColor,
                    actions: [
                      Padding(
                        padding: const EdgeInsets.only(right: 12),
                        child: Center(
                          child: ColorButton(
                            darkMode: true,
                            key: Key('c2'),
                            color: appbarColor,
                            boxShape: BoxShape.rectangle,
                            swatches: swatches,
                            size: 32,
                            config: ColorPickerConfig(
                                enableOpacity: true,
                                enableLibrary: false,
                                enableEyePicker: true),
                            onColorChanged: (value) => setState(
                              () => appbarColor = value,
                            ),
                            onSwatchesChanged: (newSwatches) =>
                                setState(() => swatches = newSwatches),
                          ),
                        ),
                      )
                    ],
                  ),
                  body: Container(
                    padding: const EdgeInsets.all(12),
                    child: Center(
                      child: Column(
                        children: [
                          Text(
                            'Select the background & appbar colors',
                            style:
                                textTheme.headline6.copyWith(color: bodyTextColor),
                          ),
                          _buildButtons(),
                          if (!kIsWeb) Center(child: Image.asset('images/img.png')),
                        ],
                      ),
                    ),
                  ),
                ));
      }
    
      Expanded _buildButtons() {
        return Expanded(
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              Center(
                child: ColorButton(
                  key: Key('c1'),
                  color: backgroundColor,
                  swatches: swatches,
                  onColorChanged: (value) => setState(
                    () => backgroundColor = value,
                  ),
                  onSwatchesChanged: (newSwatches) =>
                      setState(() => swatches = newSwatches),
                ),
              ),
              Center(
                child: ColorButton(
                  key: Key('c1'),
                  size: 32,
                  color: backgroundColor,
                  swatches: swatches,
                  decoration: BoxDecoration(
                    shape: BoxShape.rectangle,
                    color: backgroundColor,
                    border: Border.all(width: 4, color: Colors.black),
                  ),
                  onColorChanged: (value) => setState(
                    () => backgroundColor = value,
                  ),
                  onSwatchesChanged: (newSwatches) =>
                      setState(() => swatches = newSwatches),
                ),
              ),
              if (!kIsWeb)
                EyedropperButton(
                  icon: Icons.colorize,
                  onColor: (value) => setState(() => backgroundColor = value),
                ),
            ],
          ),
        );
      }
    }
    

    In any case, Thanks for your help ...

    opened by BlackStriker99 1
  • Incorrect height and scrolling when in landscape

    Incorrect height and scrolling when in landscape

    When the device rotates into landscape mode, the picker dialog gets too high and draws a bit off screen towards the top. Also, because the entire height can't be displayed, scrolling kicks in. However, the color grid area absorbs all scrolling motions, so the user can't scroll up or down to the close button or the hex color entry button. Possible solution would be: when a user, for example, is scrolling up on the color grid selector, when they reach the top row, then it starts scrolling the entire frame up to the title & close button, and the same for the bottom. I've also noticed that the scroll position doesn't always default to the top in this case, which is a bit confusing.

    Thanks, and let me know if you need more detail or a video of this happening.

    opened by widavies 1
  • License missing

    License missing

    opened by remixie 1
  • Color changing when using saturation in HSL mode

    Color changing when using saturation in HSL mode

    What I did:

    • Opened a color picker (chrome on Android)
    • Switched to HSL
    • Moved around the color
    • Moved the saturation
    • Noticed that it changed the color to red
    opened by thebiglabasky 1
Owner
Erick Ghaumez
UIngineer
Erick Ghaumez
Color-Converter - A minimalist application made with flutter to convert hexadecimal colors to RGB colors and vise-versa.

Color Converter A minimalist application made with flutter to convert hexadecimal colors to RGB colors and vise-versa for Flutter Create Competition.

Poojan Pandya 2 Sep 16, 2020
ThemeX is an easy theme manipulation. Only inform primary color and the ThemeX generate all color combination palette for you

ThemeX is an easy theme manipulation basied on Material Design. Only inform primary color and the ThemeX generate all color combination palette for yo

Michael S. Lopes 2 Jan 31, 2022
Material color picker, you can customize colors. Selection in two step, first main color and after shades.

Flutter Material Color Picker Material Color picker is a Flutter widget, that can be customizable. By default, it's Material Colors, but you can defin

Jean-Charles Moussé 70 Nov 25, 2022
Receiving ozh's github-colors repository with latest commit of colors.json to Flutter's Color object.

Apply GitHub's languages colours into Flutter's Color object. Receiving ozh's github-colors repository with latest commit of colors.json to Flutter's

Cyrus Chan 1 Jun 6, 2022
A HSV color picker for your flutter app. RGB HSV Wheel Hue Saturation Values.

flutter_hsvcolor_picker A HSV color picker for your flutter app. RGB HSV Wheel Hue Saturation Values. Getting Started Installation https://pub.dev/pac

FlutterCandies 49 Dec 8, 2022
null 0 Feb 2, 2022
Automatically generate profile picture with random first name and background color. But you can still provide pictures if you have them. As the default color, based on the name of the first letter. :fire: :fire: :fire:

FLUTTER PROFILE PICTURE Automatically generate profile picture with random first name and background color. But you can still provide pictures if you

Aditya Dharmawan Saputra 10 Dec 20, 2022
A Fluter tabview that text color can change with animation and bg color change with animation

float_tab A Fluter tabview that text color can change with animation and bg color change with animation Getting Started This project is a starting poi

ventureli 1 Dec 8, 2021
Color picker for Flutter, based on the Google Docs color picker.

Material ColorPicker Color picker for Flutter, based on the Google Docs color picker. Getting Started You can embed into your material app or use it o

Razvan Lung 103 Oct 30, 2022
A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.

flutter_statusbarcolor A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically. Getting Starte

Zero 201 Nov 10, 2022
Color matching game - A Crossplatform Color Matching Game made with Flutter

color_matching_game A Color Matching Game built with Flutter. It is a simple app made without adding a plug-in. Play by specifying the red, green and

Yusuke Ishimi 6 Nov 21, 2022
A colorful TabBar Flutter library with color animating indicator where each tab has a color. (inspired by SmartNews app)

Flutter Colorful TabBar A colorful TabBar for Flutter where each tab has a color (inspired by SmartNews app). Getting Started Add this to your package

null 8 Jun 17, 2022
meg4cyberc4t 11 Oct 24, 2022
A Very Flexible Widget that can Implement Material Sheets on all Directions, both modal and persistent, and consequently a Material Navigation Drawer

Flutter_MaterialSheetAndNavigationDrawer If this project helped you reduce developement time or you just want to help me continue making useful tools

Bryan Cancel 30 Dec 4, 2021
Material io ext - A collection of extensions for creating widgets following material.io guidelines

material_io_ext It is a collection of extensions for creating widgets following

BetterX.io 3 Jan 28, 2022
An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch.

Colours An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch. Getting Started In your flut

Salman S 4 Nov 23, 2021
An Android and iOS game about colors made using Flutter.

Random Color An Android and iOS game. A color is display on the screen and then the player has to pick a color that is the most similar to the one dis

Loïc H. 4 Nov 21, 2022
Find underused colors, overused magical numbers and the largest classes in any Flutter project.

Flutter Resource Ranker It is easy to overuse colors, write magical numbers or long classes. This project has a script to help you detect these. This

Bernardo Ferrari 24 Jul 12, 2021
Selectable Circle where colors can be customized and a child widget can be defined

selectable_circle A Flutter package for an Circle that can be Selected with animation. How to use SelectableCircle( width: 80.0, onSelected: (

null 11 Sep 29, 2021