htmlcsstwitch

Streamlabs Custom CSS, chat with background and rounded edges


Within streamlabs you can customize your chat appearance with custom HTML,CSS. This is the end result that I want to achieve. A semi transparent background with rounded edges.

enter image description here


This is the current CSS


CSS

@import url(https://fonts.googleapis.com/css?family=Roboto:700);

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    text-shadow: 0 0 1px #000, 0 0 2px #000;
    background: {background_color};
    font-family: 'Roboto';
    font-weight: 700;
    font-size: {font_size};
    line-height: 1.5em;
    color: {text_color};
}

#log>div {
    animation: fadeInRight .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards;
    -webkit-animation: fadeInRight .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards;
}

.colon {
    display: none;
}

#log {
    display: table;
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 0 10px 10px;
    width: 100%;
    table-layout: fixed;
}

#log>div {
    display: table-row;
}

#log>div.deleted {
    visibility: hidden;
}

#log .emote {
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    padding: 0.4em 0.2em;
    position: relative;
}

#log .emote img {
    display: inline-block;
    height: 1em;
    opacity: 0;
}

#log .message,#log .meta {
    vertical-align: top;
    display: table-cell;
    padding-bottom: 0.1em;
}

#log .meta {
    width: 35%;
    text-align: right;
    padding-right: 0.5em;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

#log .message {
    word-wrap: break-word;
    width: 65%;
}

.badge {
    display: inline-block;
    margin-right: 0.2em;
    position: relative;
    height: 1em;
    vertical-align: middle;
    top: -0.1em;
}

.name {
    margin-left: 0.2em;
}

The above HTML, CSS results in following chat appearance. No semi transparant background, no rounded edges. The blue background comes from the website streamlabs itself.


enter image description here


Solution

  • I found a solution. Simply use following CSS:


    CSS
    @import url(https://fonts.googleapis.com/css?family=Roboto:700);
    
    * {
        box-sizing: border-box;
    }
    
    html, body {
        height: 100%;
        overflow: hidden;
    }
    
    body {
        text-shadow: 0 0 0px #000, 0 0 0px #000;
        font-family: 'Roboto';
        font-weight: 200;
        font-size: {font_size};
        line-height: 1.5em;
        color: rgba(240, 240, 240, 1);
    }
    
    #log>div {
        animation: fadeInRight .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards;
        box-sizing: border-box;
        -webkit-animation: fadeInRight .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards;
    }
    
    .colon {
        display: none;
    }
    
    #log {
        display: table;
        position: absolute;
        bottom: 0px;
        left: 0;
        padding: 0 0px 0px;
        width: 65%;
        table-layout: fixed;
        box-sizing: border-box;
    }
    
    #log>div {
        display: flex;
        padding-bottom: 5px;
        box-sizing: border-box;
      
    }
    
    #log>div.deleted {
        visibility: hidden;
    }
    
    #log .emote {
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        padding: 0.4em 0.2em;
        position: relative;
    }
    
    #log .emote img {
        display: inline-block;
        height: 1em;
        opacity: 0;
    }
    
    #log .message,#log .meta {
        vertical-align: top;
        display: table-cell;
        padding-bottom: 0.1em;
        letter-spacing: 0.5px;
        padding: 0px;
        
    }
    
    #log .meta {
        width: 40%;
        text-align: right;
        padding-right: 0.5em;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    #log .message {
        word-wrap: break-word;
        width: 40%;
        background-color: rgba(0, 0, 0, 0.5);
        border-radius: 20px 20px 20px 0px;
        padding: 10px;
        letter-spacing: 0.5px;
    }
    
    
    
    
    .name {
        margin-left: 0.2em;
    }
    

    This is the result. The opacity can be changed under #log .message in the background-color line. Simply use 0.5 as the fourth value. For the fourth corner being round simply change the value under #log .message border-radius from zero to 20.

    enter image description here

    Rounded edges ✓ Semi Black background ✓