:orphan:

.. _colorPalette:

======================================
colorPalette
======================================

How to write by SpWML
========================

.. code-block:: none
   
   (colorPalette, sid:cp1)
   // You can use your own palette by entering color information separated by commas.
   // Starting a new line will create a color cell on a different line.
   // You can also specify a material color.
   (colorPalette, sid:cp2)#FF000000,#FF333333,#FF666666,#FF999999,white
   blue[100], blue[200], blue[300], blue[400], blue[500]

----

Summary
===============

This is a block for displaying a simple color palette.

To use this type, it is necessary to set `TextFieldManager <https://pub.dev/packages/simple_managers>`__  to SpWMLBuilder or SpWML widget.

This block extends the configured SID and consumes four namespaces: "SID:A", "SID:R", "SID:G", and "SID:B".
Each is assigned color data from 0 to 255.

You can easily change the color from Dart code by using the static ColorPaletteParams.setColorToTFM(TextFieldManager manager, String sid, Color c) function.
The manager usually passes in StateManager.tfm.

----

Dart Class Reference
======================
`ColorPaletteElement class <https://pub.dev/documentation/simple_widget_markup/latest/simple_widget_markup/ColorPaletteElement-class.html>`__

----

SpWML Parameters
====================

* :ref:`The common<spwml>` parameters.
* color (String). Set default color. :ref:`The color system<color_system>` .
* type (String). The type of color palette, it can be normal, simple, text, circle, simpleCircle. The default is normal.
* vAlign (String). Vertical alignment: start, center, top, bottom, end, baseline or stretch.
* hAlign (String). Horizontal alignment, which can be left, start, center, right, end, spaceAround, spaceEvenly or spaceBetween.
* cellHeight (double). The height of one cell in the color palette. The default is 24.0.
* cellWidth (double). The width of one cell in the color palette. The default is 24.0.
* cellMargin (double). The cells will be spaced apart by this margin. The default is 2.0.
* vMargin (double). Margin between the color palette cell and the text input. Only effective when type is normal. The default value is 12.0.
* cellBorderWidth (double). Set cells border width. The default is 1.0.
* cellBorderColor (String). Set cells border color. The default is black. :ref:`The color system<color_system>` .