{"size": 878, "ext": "js", "max_stars_repo_path": "studio/node_modules/style-value-types/dist/es/color/rgba.js", "max_stars_repo_name": "sajustsmile/twitter-blockchain", "max_stars_repo_stars_event_min_datetime": "2021-07-29T23:19:44.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-30T08:02:04.000Z", "max_issues_repo_path": "studio/node_modules/style-value-types/dist/es/color/rgba.js", "max_issues_repo_name": "sajustsmile/twitter-blockchain", "max_issues_repo_issues_event_min_datetime": "2021-05-29T16:32:51.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-13T16:05:29.000Z", "max_forks_repo_path": "studio/node_modules/style-value-types/dist/es/color/rgba.js", "max_forks_repo_name": "sajustsmile/twitter-blockchain", "max_forks_repo_forks_event_min_datetime": "2021-05-23T07:12:40.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-11T02:59:40.000Z"}
{"max_stars_count": 2, "max_issues_count": 116, "max_forks_count": 2, "avg_line_length": 33.7692307692, "max_line_length": 114, "alphanum_fraction": 0.5455580866}
import { __assign } from 'tslib';
import { number, alpha } from '../numbers/index.js';
import { sanitize, clamp } from '../utils.js';
import { isColorString, splitColor } from './utils.js';

var clampRgbUnit = clamp(0, 255);
var rgbUnit = __assign(__assign({}, number), { transform: function (v) { return Math.round(clampRgbUnit(v)); } });
var rgba = {
    test: isColorString('rgb', 'red'),
    parse: splitColor('red', 'green', 'blue'),
    transform: function (_a) {
        var red = _a.red, green = _a.green, blue = _a.blue, _b = _a.alpha, alpha$1 = _b === void 0 ? 1 : _b;
        return 'rgba(' +
            rgbUnit.transform(red) +
            ', ' +
            rgbUnit.transform(green) +
            ', ' +
            rgbUnit.transform(blue) +
            ', ' +
            sanitize(alpha.transform(alpha$1)) +
            ')';
    },
};

export { rgbUnit, rgba };
