1
0
mirror of https://github.com/konpa/devicon.git synced 2025-08-12 09:34:36 +02:00

Color picker menu can now be toggled

This commit is contained in:
Thomas Bui
2021-12-21 19:26:37 -08:00
parent cbb38dc2cc
commit 50e8a9c9cf
3 changed files with 52 additions and 14 deletions

View File

@@ -297,20 +297,40 @@ header {
.colorPicker { .colorPicker {
height: 0.8em; height: 0.8em;
width: 0.8em; width: 0.8em;
border-radius: 50%;
}
.colorPicker:hover {
cursor: pointer;
border: 1px solid whitesmoke;
} }
.colorPickerMenu { .colorPickerMenu {
position: absolute; position: absolute;
display: inline-block;
font-size: 1rem; font-size: 1rem;
background-color: var(--primaryColor); background-color: var(--primaryColor);
border-radius: 1em; border-radius: 1em;
border: 2px solid var(--grey); border: 2px solid var(--grey);
transform: translate(0, -30%); transform: translate(0, -30%);
padding: 0.5em; padding: 0.5em;
padding-top: 0;
margin-left: 1em; margin-left: 1em;
font-weight: normal; font-weight: normal;
z-index: 1; z-index: 1;
display: none;
}
.colorPickerMenuCloseBtn {
color: red;
font-weight: bold;
margin-top: 0;
margin-right: 0.25em;
display: flex;
flex-direction: row-reverse;
}
.colorPickerMenuCloseBtn > span:hover {
cursor: pointer;
} }
.colorPickerResetBtn { .colorPickerResetBtn {
@@ -330,12 +350,20 @@ header {
top: 0.2em; top: 0.2em;
} }
input[type='color'] { .checkerboardInput:hover {
cursor: pointer;
}
#colorInput {
width: 1.25em; width: 1.25em;
height: 1.25em; height: 1.25em;
padding: 0; padding: 0;
} }
#colorInput:hover {
cursor: pointer;
}
/** Copy Btn */ /** Copy Btn */
.copyBtn { .copyBtn {

View File

@@ -202,6 +202,15 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) {
}, 50) }, 50)
}, 2000) }, 2000)
} }
/**
* Display the color picker.
* @param {String} id - id of the menu we are showing.
*/
$scope.toggleColorPickerMenu = function(id) {
let menu = document.getElementById(id)
menu.style.display = menu.style.display == "none" || menu.style.display == "" ? "inherit" : "none"
}
}); });
/*================ End of "Devicons controller" ================*/ /*================ End of "Devicons controller" ================*/

View File

@@ -63,19 +63,20 @@
<li> <li>
<h4> <h4>
Font versions Font versions
<img src="./assets/img/color_wheel.png" class='colorPicker'> <span>
<span class='colorPickerMenu'> <img src="./assets/img/color_wheel.png" class='colorPicker' ng-click="toggleColorPickerMenu('fontColorPickerMenu')">
<span> <span class='colorPickerMenu' id='fontColorPickerMenu'>
<input type='color' value='#60be86' ng-model="fontBackground"> <div class='colorPickerMenuCloseBtn' ng-click="toggleColorPickerMenu('fontColorPickerMenu')"><span>X</span></div>
Background Color <div>
<input type='color' value='#60be86' ng-model="fontBackground" id='colorInput'>
Background Color
</div>
<div>
<input type='checkbox' id='checkboardInput' class='checkerboardInput'>
<label for='checkboardInput' >Checkerboard</label>
</div>
<button class='colorPickerResetBtn'>Reset</button>
</span> </span>
<br>
<span>
<input type='checkbox' id='checkboardInput' class='checkerboardInput'>
<label for='checkboardInput' >Checkerboard</label>
</span>
<br>
<button class='colorPickerResetBtn'>Reset</button>
</span> </span>
</h4> </h4>
<p> <p>