Book Image

Dart By Example

By : David Mitchell
Book Image

Dart By Example

By: David Mitchell

Overview of this book

Table of Contents (17 chapters)
Dart By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Changing the colors


HTML5 provides browsers with a full-featured color picker (typically, browsers use the native OS's color chooser). This will be used to allow the user to set the background color of the editor application itself:

The color picker is added to the index.html page with the following HTML:

<input id="pckBackColor" type="color">

The implementation is straightforward as the color picker control provides:

InputElement cp = qs("#pckBackColor");
cp.onChange.listen((e) => document.body.style.backgroundColor = cp.value);

Because the event and property (onChange and value) are common to the input controls, the basic InputElement class can be used.