Spaces:
Runtime error
Runtime error
File size: 699 Bytes
db4f9a3 68778bc db4f9a3 68778bc db4f9a3 68778bc db4f9a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import streamlit as st
import wcag_contrast_ratio as contrast
import util
def contrast_summary(foreground_rgb_hex: str, background_rgb_hex: str) -> None:
rgb_foreground = util.parse_hex(foreground_rgb_hex)
rgb_background = util.parse_hex(background_rgb_hex)
contrast_ratio = contrast.rgb(rgb_foreground, rgb_background)
contrast_ratio_str = f"{contrast_ratio:.2f}"
st.metric("", value=f"{contrast_ratio_str} : 1")
st.markdown(f'<p style="color: {foreground_rgb_hex}; background-color: {background_rgb_hex}; padding: 12px">Lorem ipsum</p>', unsafe_allow_html=True)
def sample_components(key: str):
st.slider("Slider", min_value=0, max_value=100, key=f"{key}:slider")
|