create table stars (
    id Integer Primary Key Generated Always as Identity,
    color varchar(7) not null
);

alter table stars
add constraint color_hex_constraint
check (color ~* '^#[a-f0-9]{2}[a-f0-9]{2}[a-f0-9]{2}$');