hsl to rgb conversion tool
Below HSL to RGB converter takes input as HSL(hue, saturation, lightness) and then convert input (HSL Color) to a RGB color code.
HSL to RGB Conversion
If you are a web developer looking to develop an HSL to RGB color picker tool.below you can find the javascript code.
hsl to rgb javascript function
<script type="text/javascript">
function hsltorgbconversion(h,s,l) {
if (h == "") h = 0;
if (s == "") s = 0;
if (l == "") l = 0;
h = parseFloat(h);
s = parseFloat(s);
l = parseFloat(l);
if (h < 0) h = 0;
if (s < 0) s = 0;
if (l < 0) l = 0;
if (h >= 360) h = 359;
if (s > 100) s = 100;
if (l > 100) l = 100;
s /= 100;
l /= 100;
C = (1 - Math.abs(2 * l - 1)) * s;
hh = h / 60;
X = C * (1 - Math.abs(hh % 2 - 1));
r = g = b = 0;
if (hh >= 0 && hh < 1) {
r = C;
g = X;
}
else if (hh >= 1 && hh < 2) {
r = X;
g = C;
}
else if (hh >= 2 && hh < 3) {
g = C;
b = X;
}
else if (hh >= 3 && hh < 4) {
g = X;
b = C;
}
else if (hh >= 4 && hh < 5) {
r = X;
b = C;
}
else {
r = C;
b = X;
}
m = l - C / 2;
r += m;
g += m;
b += m;
r *= 255.0;
g *= 255.0;
b *= 255.0;
r = Math.round(r);
g = Math.round(g);
b = Math.round(b);
hex = r * 65536 + g * 256 + b;
hex = hex.toString(16, 6);
len = hex.length;
if (len < 6)
for (i = 0; i < 6 - len; i++)
hex = '0' + hex;
hex ="#" +hex.toUpperCase();
}
</script>
A few years ago, the design of the website was designed only by keeping the screen size of the desktop or laptop fixed-width design as the devices with small screen sizes was very less and people used to visit their desktop computer to visit the website.
Since the development of mobile devices and smartphones has increased, the requirement of mobile version websites has increased.
Now people are choosing to visit the website from their smartphone, so you should make your site mobile friendly as soon as possible.
As the number of smartphones and mobile devices used increased So that web designers could not accurately show a fixed-width website on different size screens.
In order to tackle this problem, web designers took a path that created separate sites for desktop and mobile devices.But this task was not so easy,creating different versions for every screen size and resolutions was an impossible task.If different versions of a website were created, its maintenance cost would have been increased and separate work for SEO promotion and promotion of separate sites.
What is Responsive Web Design?
Responsive web design is a technique in which the website is designed in such a way that it adjusts its layout according to the screen size and orientation, from a desktop, laptop, tablet to mobile devices with a small screen.
Benefits of Responsive Website:
Mobile traffic will increase: If your website is responsive then mobile visitors will definitely like it and this will increase the traffic of the website.
The website loading speed will increase: If you have optimized your website for mobile and tablets, it will not take much time for webpages to open and the site will improve.
It is easy to manage: If you create separate sites for desktop and mobile, then it is obvious that promoting two different sites will not be easy to promote. But if your website is responsive then you will complete your task from a single site.
Google also recommends: RWD liked Google because the responsive website's URL is the same for all devices, so Google makes it easier to index and to crawl it.
Media Queries
CSS Media queries have great feature through which we can display different layout in different ways like screen, print, handheld etc.on different media types.
You can customize website layout according to individual screen resolution and orientation using media queries.
If you want to know if a website is responsive or not, its easiest way is to open the site on the browser and then lower the size of the browser window and see if the components of the website are shifted and according to the window size If you get adjusted then understand that the site is responsive.
The post hsl to rgb converter-best online tool appeared first on Software Development | Programming Tutorials.
Read More Articles
- Free Online Sample XML API for Testing Purpose
- [Best Way]-How to display JSON data in HTML using Ajax
- Free Online Sample Rest API URL For Testing
- Online JSON Formatter & Optimizer
- Online Learning Write For Us
- [Solved]-Best Sql server query with pagination and count
- hex to cmyk converter-best online tool
- hsv to rgb converter -best online tool
- hsl to rgb converter-best online tool
- rgb to hsl converter-best online tool