all files / src/creator/ rgb-alpha-creator.js

100% Statements 28/28
100% Branches 12/12
100% Functions 7/7
100% Lines 5/5
2 statements, 4 branches Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18                     136×        
import { Color } from "../color";
 
/**
 * アルファ値を含むRGB表現の作成処理を提供します。
 */
class RgbAlphaCreator {
    /**
     * 色表現を作成します。
     * @param {Color} color 生成元の色情報。
     * @return {String} 色表現。
     */
    create(color) {
        return `rgb(${color.r},${color.g},${color.b},${color.a != null ? Math.round(color.a) : 100}%)`;
    }
}
 
export { RgbAlphaCreator };