annyang实现浏览器中说出颜色自动变色显示效果代码

代码语言:html

所属分类:其他

代码描述:annyang实现浏览器中说出颜色自动变色显示效果代码,大声对着麦克风说出左侧的颜色中文,js会自动识别你说的颜色并更换网页背景为相应的颜色。

代码标签: annyang 浏览器 说出 颜色 自动 变色 显示

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">

<head>
   
<meta charset="UTF-8">
   
<style>
        html
, body {
           
height: 100%;
       
}

        body
{
           
background-color: black;
           
color: white;
           
display: flex;
           
flex-direction: row;
           
font-size: 14px;
           
font-weight: 300;
           
transition: all 300ms ease-in;
       
}

       
.colors {
           
display: flex;
           
flex: 0;
           
flex-basis: 100px;
           
flex-direction: column;
           
list-style: none;
           
margin: 0;
           
padding: 0;
       
}

       
.colors li {
           
align-items: center;
           
display: flex;
           
flex: 1;
           
padding: 3px 1em;
       
}

       
.message {
           
align-items: center;
           
display: flex;
           
flex: 1;
           
flex-direction: column;
           
font-size: 2em;
           
justify-content: center;
       
}

       
.message [class*=icon] {
           
font-size: 3em;
       
}

       
.message-output {
           
background-color: rgba(255, 255, 255, 0.1);
           
border-radius: 1em;
           
color: white;
           
height: 2em;
           
line-height: 2em;
           
margin: 0.5em 0;
           
min-width: 2em;
           
padding: 0 1em;
       
}

       
.message small {
           
color: rgba(255, 255, 255, 0.8);
           
font-size: 0.5em;
       
}
   
</style>
</head>

<body translate="no&quo.........完整代码请登录后点击上方下载按钮下载查看

网友评论0