Angular Color Editor (カラー エディター) の概要 Preview
Ignite UI for Angular Color Editor は軽量のカラー ピッカー コンポーネントです。Color Editor は、ブラッシ アイコンをクリックすると開きます。RGBA 値と 16 進値の両方を、下部にある目的の色から取得できます。これらの値は、3 つのスライダーが変更されると更新されます。中央のボックスは、彩度と明度を調整するために設計されており、隣接する 2つ のスライダーで rgb 値と輝度値を調整できます。RGB は (1~255) の範囲で登録されます。明度は (0~1) の範囲で登録されます。
Angular Color Editor の例
依存関係
まず、次のコマンドを実行して Ignite UI for Angular をインストールする必要があります:
npm install igniteui-angular-core
npm install igniteui-angular-inputs
IgxColorEditorComponent を使用する前に、次のモジュールを登録する必要があります:
import { IgxColorEditorModule } from 'igniteui-angular-inputs';
// ...
// app.module.ts
@NgModule({
imports: [
IgxColorEditorModule
]
})
export class AppModule { }
使用方法
IgxColorEditorComponent の使用を開始する最も簡単な方法は次のとおりです:
<igx-color-editor
#colorEditor>
</igx-color-editor>
イベントにバインド
Color Editor コンポーネントは、次のイベントを発生させます:
- valueChanged
- valueChanging
<igx-color-editor
#colorEditor
(valueChanged)="this.colorEditorValueChanged($event)">
</igx-color-editor>
ハンドラーにはエディターと IgxColorEditorPanelSelectedValueChangedEventArgs が渡され、その newValue に選択された色が格納されます。
console.log("selected color: " + args.newValue);
API リファレンス
IgxColorEditorComponent