Best JavaScript code snippet using storybook-root
graphsTrend.js
Source:graphsTrend.js
1$(document).ready(function() {2 function darkenColor(colorStr) {3 var color = Dygraph.toRGB_(colorStr);4 color.r = Math.floor((255 + color.r) / 2);5 color.g = Math.floor((255 + color.g) / 2);6 color.b = Math.floor((255 + color.b) / 2);7 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';8 }9 function barChartPlotter(e) {10 var ctx = e.drawingContext;11 var points = e.points;12 var y_bottom = e.dygraph.toDomYCoord(0);13 ctx.fillStyle = darkenColor(e.color);14 var min_sep = Infinity;15 for (var i = 1; i < points.length; i++) {16 var sep = points[i].canvasx - points[i - 1].canvasx;17 if (sep < min_sep) min_sep = sep;18 }19 var bar_width = Math.floor(2.0 / 3 * min_sep);20 for (var i = 0; i < points.length; i++) {21 var p = points[i];22 var center_x = p.canvasx;23 ctx.fillRect(center_x - bar_width / 2, p.canvasy,24 bar_width, y_bottom - p.canvasy);25 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,26 bar_width, y_bottom - p.canvasy);27 }28 }29 g = new Dygraph(30 document.getElementById("Graph"),31 "KEAcsv/RevenueCOM.csv",32 {33 legend: 'always',34 title: 'Commercial Revenue ($1000)',35 includeZero: false,36 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],37 animatedZooms: true,38 plotter: barChartPlotter,39 axes: {40 x: {41 drawGrid: false42 }43 }44 }45 );46 window.fun = function()47{48 var ddl = document.getElementById("myListTREND");49 var selectedValue = ddl.options[ddl.selectedIndex].value;50 51 52 if (selectedValue == "consumersC")53 {54 function clearCanvas(){55 var c = document.getElementById("Graph");56 var ctx = c.getContext("2d");57 ctx.clearRect(0, 0, c.width, c.height);58 ctx.beginPath();59 }60 61 function darkenColor(colorStr) {62 var color = Dygraph.toRGB_(colorStr);63 color.r = Math.floor((255 + color.r) / 2);64 color.g = Math.floor((255 + color.g) / 2);65 color.b = Math.floor((255 + color.b) / 2);66 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';67 }68 function barChartPlotter(e) {69 var ctx = e.drawingContext;70 var points = e.points;71 var y_bottom = e.dygraph.toDomYCoord(0);72 ctx.fillStyle = darkenColor(e.color);73 var min_sep = Infinity;74 for (var i = 1; i < points.length; i++) {75 var sep = points[i].canvasx - points[i - 1].canvasx;76 if (sep < min_sep) min_sep = sep;77 }78 var bar_width = Math.floor(2.0 / 3 * min_sep);79 for (var i = 0; i < points.length; i++) {80 var p = points[i];81 var center_x = p.canvasx;82 ctx.fillRect(center_x - bar_width / 2, p.canvasy,83 bar_width, y_bottom - p.canvasy);84 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,85 bar_width, y_bottom - p.canvasy);86 }87 }88 g = new Dygraph(89 document.getElementById("Graph"),90 "KEAcsv/ConsumerCOM.csv",91 {92 legend: 'always',93 title: 'Number of Commercial Consumers',94 includeZero: false,95 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],96 animatedZooms: true,97 plotter: barChartPlotter,98 axes: {99 x: {100 drawGrid: false101 }102 }103 }104 );105 106 }107 108 if (selectedValue == "salesC")109 {110 function clearCanvas(){111 var c = document.getElementById("Graph");112 var ctx = c.getContext("2d");113 ctx.clearRect(0, 0, c.width, c.height);114 ctx.beginPath();115 }116 117 function darkenColor(colorStr) {118 var color = Dygraph.toRGB_(colorStr);119 color.r = Math.floor((255 + color.r) / 2);120 color.g = Math.floor((255 + color.g) / 2);121 color.b = Math.floor((255 + color.b) / 2);122 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';123 }124 function barChartPlotter(e) {125 var ctx = e.drawingContext;126 var points = e.points;127 var y_bottom = e.dygraph.toDomYCoord(0);128 ctx.fillStyle = darkenColor(e.color);129 var min_sep = Infinity;130 for (var i = 1; i < points.length; i++) {131 var sep = points[i].canvasx - points[i - 1].canvasx;132 if (sep < min_sep) min_sep = sep;133 }134 var bar_width = Math.floor(2.0 / 3 * min_sep);135 for (var i = 0; i < points.length; i++) {136 var p = points[i];137 var center_x = p.canvasx;138 ctx.fillRect(center_x - bar_width / 2, p.canvasy,139 bar_width, y_bottom - p.canvasy);140 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,141 bar_width, y_bottom - p.canvasy);142 }143 }144 g = new Dygraph(145 document.getElementById("Graph"),146 "KEAcsv/SalesCOM.csv",147 {148 legend: 'always',149 title: 'Commercial Sales',150 includeZero: false,151 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],152 animatedZooms: true,153 plotter: barChartPlotter,154 axes: {155 x: {156 drawGrid: false157 }158 }159 }160 );161 162 }163 164 if (selectedValue == "revenueC")165 {166 function clearCanvas(){167 var c = document.getElementById("Graph");168 var ctx = c.getContext("2d");169 ctx.clearRect(0, 0, c.width, c.height);170 ctx.beginPath();171 }172 173 function darkenColor(colorStr) {174 var color = Dygraph.toRGB_(colorStr);175 color.r = Math.floor((255 + color.r) / 2);176 color.g = Math.floor((255 + color.g) / 2);177 color.b = Math.floor((255 + color.b) / 2);178 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';179 }180 function barChartPlotter(e) {181 var ctx = e.drawingContext;182 var points = e.points;183 var y_bottom = e.dygraph.toDomYCoord(0);184 ctx.fillStyle = darkenColor(e.color);185 var min_sep = Infinity;186 for (var i = 1; i < points.length; i++) {187 var sep = points[i].canvasx - points[i - 1].canvasx;188 if (sep < min_sep) min_sep = sep;189 }190 var bar_width = Math.floor(2.0 / 3 * min_sep);191 for (var i = 0; i < points.length; i++) {192 var p = points[i];193 var center_x = p.canvasx;194 ctx.fillRect(center_x - bar_width / 2, p.canvasy,195 bar_width, y_bottom - p.canvasy);196 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,197 bar_width, y_bottom - p.canvasy);198 }199 }200 g = new Dygraph(201 document.getElementById("Graph"),202 "KEAcsv/RevenueCOM.csv",203 {204 legend: 'always',205 title: 'Commercial Revenue ($1000)',206 includeZero: false,207 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],208 animatedZooms: true,209 plotter: barChartPlotter,210 axes: {211 x: {212 drawGrid: false213 }214 }215 }216 );217 218 }219 220 if (selectedValue == "consumersI")221 {222 function clearCanvas(){223 var c = document.getElementById("Graph");224 var ctx = c.getContext("2d");225 ctx.clearRect(0, 0, c.width, c.height);226 ctx.beginPath();227 }228 229 function darkenColor(colorStr) {230 var color = Dygraph.toRGB_(colorStr);231 color.r = Math.floor((255 + color.r) / 2);232 color.g = Math.floor((255 + color.g) / 2);233 color.b = Math.floor((255 + color.b) / 2);234 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';235 }236 function barChartPlotter(e) {237 var ctx = e.drawingContext;238 var points = e.points;239 var y_bottom = e.dygraph.toDomYCoord(0);240 ctx.fillStyle = darkenColor(e.color);241 var min_sep = Infinity;242 for (var i = 1; i < points.length; i++) {243 var sep = points[i].canvasx - points[i - 1].canvasx;244 if (sep < min_sep) min_sep = sep;245 }246 var bar_width = Math.floor(2.0 / 3 * min_sep);247 for (var i = 0; i < points.length; i++) {248 var p = points[i];249 var center_x = p.canvasx;250 ctx.fillRect(center_x - bar_width / 2, p.canvasy,251 bar_width, y_bottom - p.canvasy);252 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,253 bar_width, y_bottom - p.canvasy);254 }255 }256 g = new Dygraph(257 document.getElementById("Graph"),258 "KEAcsv/ConsumerIND.csv",259 {260 legend: 'always',261 title: 'Number of Industrial Consumers',262 includeZero: false,263 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],264 animatedZooms: true,265 plotter: barChartPlotter,266 axes: {267 x: {268 drawGrid: false269 }270 }271 }272 );273 274 }275 276 if (selectedValue == "salesI")277 {278 function clearCanvas(){279 var c = document.getElementById("Graph");280 var ctx = c.getContext("2d");281 ctx.clearRect(0, 0, c.width, c.height);282 ctx.beginPath();283 }284 285 function darkenColor(colorStr) {286 var color = Dygraph.toRGB_(colorStr);287 color.r = Math.floor((255 + color.r) / 2);288 color.g = Math.floor((255 + color.g) / 2);289 color.b = Math.floor((255 + color.b) / 2);290 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';291 }292 function barChartPlotter(e) {293 var ctx = e.drawingContext;294 var points = e.points;295 var y_bottom = e.dygraph.toDomYCoord(0);296 ctx.fillStyle = darkenColor(e.color);297 var min_sep = Infinity;298 for (var i = 1; i < points.length; i++) {299 var sep = points[i].canvasx - points[i - 1].canvasx;300 if (sep < min_sep) min_sep = sep;301 }302 var bar_width = Math.floor(2.0 / 3 * min_sep);303 for (var i = 0; i < points.length; i++) {304 var p = points[i];305 var center_x = p.canvasx;306 ctx.fillRect(center_x - bar_width / 2, p.canvasy,307 bar_width, y_bottom - p.canvasy);308 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,309 bar_width, y_bottom - p.canvasy);310 }311 }312 g = new Dygraph(313 document.getElementById("Graph"),314 "KEAcsv/SalesIND.csv",315 {316 legend: 'always',317 title: 'Industrial Sales',318 includeZero: false,319 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],320 animatedZooms: true,321 plotter: barChartPlotter,322 axes: {323 x: {324 drawGrid: false325 }326 }327 }328 );329 330 }331 332 if (selectedValue == "revenueI")333 {334 function clearCanvas(){335 var c = document.getElementById("Graph");336 var ctx = c.getContext("2d");337 ctx.clearRect(0, 0, c.width, c.height);338 ctx.beginPath();339 }340 341 function darkenColor(colorStr) {342 var color = Dygraph.toRGB_(colorStr);343 color.r = Math.floor((255 + color.r) / 2);344 color.g = Math.floor((255 + color.g) / 2);345 color.b = Math.floor((255 + color.b) / 2);346 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';347 }348 function barChartPlotter(e) {349 var ctx = e.drawingContext;350 var points = e.points;351 var y_bottom = e.dygraph.toDomYCoord(0);352 ctx.fillStyle = darkenColor(e.color);353 var min_sep = Infinity;354 for (var i = 1; i < points.length; i++) {355 var sep = points[i].canvasx - points[i - 1].canvasx;356 if (sep < min_sep) min_sep = sep;357 }358 var bar_width = Math.floor(2.0 / 3 * min_sep);359 for (var i = 0; i < points.length; i++) {360 var p = points[i];361 var center_x = p.canvasx;362 ctx.fillRect(center_x - bar_width / 2, p.canvasy,363 bar_width, y_bottom - p.canvasy);364 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,365 bar_width, y_bottom - p.canvasy);366 }367 }368 g = new Dygraph(369 document.getElementById("Graph"),370 "KEAcsv/RevenueIND.csv",371 {372 legend: 'always',373 title: 'Industrial Revenue ($1000)',374 includeZero: false,375 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],376 animatedZooms: true,377 plotter: barChartPlotter,378 axes: {379 x: {380 drawGrid: false381 }382 }383 }384 );385 386 }387 388 if (selectedValue == "consumersR")389 {390 function clearCanvas(){391 var c = document.getElementById("Graph");392 var ctx = c.getContext("2d");393 ctx.clearRect(0, 0, c.width, c.height);394 ctx.beginPath();395 }396 397 function darkenColor(colorStr) {398 var color = Dygraph.toRGB_(colorStr);399 color.r = Math.floor((255 + color.r) / 2);400 color.g = Math.floor((255 + color.g) / 2);401 color.b = Math.floor((255 + color.b) / 2);402 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';403 }404 function barChartPlotter(e) {405 var ctx = e.drawingContext;406 var points = e.points;407 var y_bottom = e.dygraph.toDomYCoord(0);408 ctx.fillStyle = darkenColor(e.color);409 var min_sep = Infinity;410 for (var i = 1; i < points.length; i++) {411 var sep = points[i].canvasx - points[i - 1].canvasx;412 if (sep < min_sep) min_sep = sep;413 }414 var bar_width = Math.floor(2.0 / 3 * min_sep);415 for (var i = 0; i < points.length; i++) {416 var p = points[i];417 var center_x = p.canvasx;418 ctx.fillRect(center_x - bar_width / 2, p.canvasy,419 bar_width, y_bottom - p.canvasy);420 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,421 bar_width, y_bottom - p.canvasy);422 }423 }424 g = new Dygraph(425 document.getElementById("Graph"),426 "KEAcsv/ConsumerRES.csv",427 {428 legend: 'always',429 title: 'Number of Residental Consumers',430 includeZero: false,431 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],432 animatedZooms: true,433 plotter: barChartPlotter,434 axes: {435 x: {436 drawGrid: false437 }438 }439 }440 );441 442 }443 444 if (selectedValue == "salesR")445 {446 function clearCanvas(){447 var c = document.getElementById("Graph");448 var ctx = c.getContext("2d");449 ctx.clearRect(0, 0, c.width, c.height);450 ctx.beginPath();451 }452 453 function darkenColor(colorStr) {454 var color = Dygraph.toRGB_(colorStr);455 color.r = Math.floor((255 + color.r) / 2);456 color.g = Math.floor((255 + color.g) / 2);457 color.b = Math.floor((255 + color.b) / 2);458 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';459 }460 function barChartPlotter(e) {461 var ctx = e.drawingContext;462 var points = e.points;463 var y_bottom = e.dygraph.toDomYCoord(0);464 ctx.fillStyle = darkenColor(e.color);465 var min_sep = Infinity;466 for (var i = 1; i < points.length; i++) {467 var sep = points[i].canvasx - points[i - 1].canvasx;468 if (sep < min_sep) min_sep = sep;469 }470 var bar_width = Math.floor(2.0 / 3 * min_sep);471 for (var i = 0; i < points.length; i++) {472 var p = points[i];473 var center_x = p.canvasx;474 ctx.fillRect(center_x - bar_width / 2, p.canvasy,475 bar_width, y_bottom - p.canvasy);476 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,477 bar_width, y_bottom - p.canvasy);478 }479 }480 g = new Dygraph(481 document.getElementById("Graph"),482 "KEAcsv/SalesRES.csv",483 {484 legend: 'always',485 title: 'Residental Sales',486 includeZero: false,487 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],488 animatedZooms: true,489 plotter: barChartPlotter,490 axes: {491 x: {492 drawGrid: false493 }494 }495 }496 );497 498 }499 500 if (selectedValue == "revenueR")501 {502 function clearCanvas(){503 var c = document.getElementById("Graph");504 var ctx = c.getContext("2d");505 ctx.clearRect(0, 0, c.width, c.height);506 ctx.beginPath();507 }508 509 function darkenColor(colorStr) {510 var color = Dygraph.toRGB_(colorStr);511 color.r = Math.floor((255 + color.r) / 2);512 color.g = Math.floor((255 + color.g) / 2);513 color.b = Math.floor((255 + color.b) / 2);514 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';515 }516 function barChartPlotter(e) {517 var ctx = e.drawingContext;518 var points = e.points;519 var y_bottom = e.dygraph.toDomYCoord(0);520 ctx.fillStyle = darkenColor(e.color);521 var min_sep = Infinity;522 for (var i = 1; i < points.length; i++) {523 var sep = points[i].canvasx - points[i - 1].canvasx;524 if (sep < min_sep) min_sep = sep;525 }526 var bar_width = Math.floor(2.0 / 3 * min_sep);527 for (var i = 0; i < points.length; i++) {528 var p = points[i];529 var center_x = p.canvasx;530 ctx.fillRect(center_x - bar_width / 2, p.canvasy,531 bar_width, y_bottom - p.canvasy);532 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,533 bar_width, y_bottom - p.canvasy);534 }535 }536 g = new Dygraph(537 document.getElementById("Graph"),538 "KEAcsv/RevenueRES.csv",539 {540 legend: 'always',541 title: 'Residental Revenue ($1000)',542 includeZero: false,543 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],544 animatedZooms: true,545 plotter: barChartPlotter,546 axes: {547 x: {548 drawGrid: false549 }550 }551 }552 );553 554 }555 556 557 };558 559 560 561 window.fun2 = function()562{563 var ddl = document.getElementById("myListHYDRO");564 var selectedValue = ddl.options[ddl.selectedIndex].value; 565 566 if (selectedValue == "grossTL")567 {568 function clearCanvas(){569 var c = document.getElementById("Graph");570 var ctx = c.getContext("2d");571 ctx.clearRect(0, 0, c.width, c.height);572 ctx.beginPath();573 }574 575 function darkenColor(colorStr) {576 var color = Dygraph.toRGB_(colorStr);577 color.r = Math.floor((255 + color.r) / 2);578 color.g = Math.floor((255 + color.g) / 2);579 color.b = Math.floor((255 + color.b) / 2);580 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';581 }582 function barChartPlotter(e) {583 var ctx = e.drawingContext;584 var points = e.points;585 var y_bottom = e.dygraph.toDomYCoord(0);586 ctx.fillStyle = darkenColor(e.color);587 var min_sep = Infinity;588 for (var i = 1; i < points.length; i++) {589 var sep = points[i].canvasx - points[i - 1].canvasx;590 if (sep < min_sep) min_sep = sep;591 }592 var bar_width = Math.floor(2.0 / 3 * min_sep);593 for (var i = 0; i < points.length; i++) {594 var p = points[i];595 var center_x = p.canvasx;596 ctx.fillRect(center_x - bar_width / 2, p.canvasy,597 bar_width, y_bottom - p.canvasy);598 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,599 bar_width, y_bottom - p.canvasy);600 }601 }602 g = new Dygraph(603 document.getElementById("Graph"),604 "KEAcsv/GrossWTF.csv",605 {606 legend: 'always',607 title: 'Generated Power/ Month',608 includeZero: false,609 dateWindow: [ Date.parse("2011/12/12"), Date.parse("2017/02/26") ],610 animatedZooms: true,611 plotter: barChartPlotter,612 axes: {613 x: {614 drawGrid: false615 }616 }617 }618 );619 620 }621 };622 623 624 window.fun3 = function()625{626 var ddl = document.getElementById("myListWIND");627 var selectedValue = ddl.options[ddl.selectedIndex].value; 628 629 if (selectedValue == "grossWTF")630 {631 function clearCanvas(){632 var c = document.getElementById("Graph");633 var ctx = c.getContext("2d");634 ctx.clearRect(0, 0, c.width, c.height);635 ctx.beginPath();636 }637 638 function darkenColor(colorStr) {639 var color = Dygraph.toRGB_(colorStr);640 color.r = Math.floor((255 + color.r) / 2);641 color.g = Math.floor((255 + color.g) / 2);642 color.b = Math.floor((255 + color.b) / 2);643 return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';644 }645 function barChartPlotter(e) {646 var ctx = e.drawingContext;647 var points = e.points;648 var y_bottom = e.dygraph.toDomYCoord(0);649 ctx.fillStyle = darkenColor(e.color);650 var min_sep = Infinity;651 for (var i = 1; i < points.length; i++) {652 var sep = points[i].canvasx - points[i - 1].canvasx;653 if (sep < min_sep) min_sep = sep;654 }655 var bar_width = Math.floor(2.0 / 3 * min_sep);656 for (var i = 0; i < points.length; i++) {657 var p = points[i];658 var center_x = p.canvasx;659 ctx.fillRect(center_x - bar_width / 2, p.canvasy,660 bar_width, y_bottom - p.canvasy);661 ctx.strokeRect(center_x - bar_width / 2, p.canvasy,662 bar_width, y_bottom - p.canvasy);663 }...
service.js
Source:service.js
1/**2 * Nanocloud turns any traditional software into a cloud solution, without3 * changing or redeveloping existing source code.4 *5 * Copyright (C) 2016 Nanocloud Software6 *7 * This file is part of Nanocloud.8 *9 * Nanocloud is free software; you can redistribute it and/or modify10 * it under the terms of the GNU Affero General Public License as11 * published by the Free Software Foundation, either version 3 of the12 * License, or (at your option) any later version.13 *14 * Nanocloud is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU Affero General Public License for more details.18 *19 * You should have received a copy of the GNU Affero General20 * Public License21 * along with this program. If not, see22 * <http://www.gnu.org/licenses/>.23 */24import Ember from 'ember';25import colorAdjust from 'nanocloud/utils/color-adjust';26import config from 'nanocloud/config/environment';27export default Ember.Service.extend({28 setupColor(color) {29 config.APP.primaryColor = color;30 var lightenColor = colorAdjust(color, 20);31 var darkenColor = colorAdjust(color, -15);32 let collection = [33 `.background-color-default{background-color:${color}}`,34 `.background-color-default a:hover{background-color:${lightenColor}}`,35 `.background-color-default li .active{color:${lightenColor}}`,36 `.nav-link.active{background-color:${color} !important}`,37 `.background-nav-default:focus{color:${darkenColor}}`,38 `.background-nav-default.active{color:${darkenColor}}`,39 `.btn-color-default{background-color:${color}}`,40 `.btn-color-default li:hover{background-color:${lightenColor}}`,41 `.btn-color-default{border-color:${lightenColor}}`,42 `.btn-color-default:hover{border-color:${darkenColor}}`,43 `.btn-color-default:hover{background-color:${lightenColor}}`,44 `.btn-color-default:focus{background-color:${darkenColor}}`,45 `.btn-color-default:active{background-color:${darkenColor}}`,46 `.btn-color-default:disabled:hover{background-color:${lightenColor}}`,47 `.btn-color-default:active:focus{background-color:${darkenColor}}`,48 `.btn-color-default:active:focus{border-color:${lightenColor}}`,49 `.btn-color-default:active:hover{border-color:${darkenColor}}`,50 `.btn-color-default:active:hover{background-color:${darkenColor}}`,51 `.btn-color-default:focus{border-color:${lightenColor}}`,52 `.btn-color-default:active{border-color:${lightenColor}}`,53 `.btn-color-default:disabled:hover{border-color:${color}}`,54 `.form-control:focus{border-color:${lightenColor}}`,55 `.form-control:focus{box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px ${lightenColor}}`,56 `a{color:${color}}`,57 `.link a{color:${color}}`,58 `a:hover{color:${lightenColor}}`,59 `.color-default span{color:${color}}`,60 `.color-default span:hover{color:${color}}`,61 `.color-default i{color:${color}}`,62 `.color-default i:hover{color:${color}}`,63 `.color-default a{color:${color}}`,64 `.color-default a:hover{color:${color}}`,65 `a:focus{color:${darkenColor}}`,66 `.spinner > div{background-color:${color}}`,67 `.edit{color:${color}}`,68 `.edit:hover{color:${lightenColor}}`,69 `.alert-info{color:${darkenColor}}`,70 `.nano-switch.enabled{background-color:${color}}`,71 `.nano-switch.enabled{border-color:${color}}`,72 `.nano-switch.disabled{color:${color}}`,73 `.nano-switch.disabled:hover{color:${darkenColor}}`,74 `.tooltipster-default{background-color:${color}}`,75 `.list-group-item.active{background-color:${color}}`,76 `.list-group-item.active:hover{background-color:${color}}`,77 `.list-group-item.active{border-color:${color}}`,78 `.list-group-item.active:hover{border-color:${color}}`,79 `.popup-component .arrow{background-color:${color}}`,80 `.icon-component.hover-darker:hover i{color:${darkenColor}}`,81 `input:focus{outline-color:${color}}`,82 `button:focus{outline-color:${color}}`,83 `.btn:active:focus{outline-color:${color}}`,84 `.icon_link{color:${color}}`,85 `.icon_link:hover{color:${lightenColor}}`,86 `.icon_link.focus{color:${darkenColor}}`,87 `.vdi .vdi-topbar .item:hover{color:${lightenColor}}`,88 `.vdi .vdi-topbar .item:hover i{color:${lightenColor} !important}`,89 `.vdi .vdi-topbar .selected, .vdi .vdi-topbar .selected i{color:${color} !important}`,90 `.file-explorer .file-list-wrapper > .item.selected{background-color:${color}}`,91 `.file-explorer .file-list-wrapper > .item:hover{color:${darkenColor}}`,92 `.file-explorer .file-list-wrapper > .item:hover.selected{color:#ffffff}`,93 `.vdi-drag-n-drop .drag-n-drop-area{background-color:${lightenColor}}`,94 `.icon-component.hover-lighter:hover i{color:${lightenColor}}`,95 `md-checkbox.md-default-theme.md-checked .md-icon, md-checkbox.md-checked .md-icon{background-color:${lightenColor}}`,96 ].join('');97 let head = Ember.$(document.head);98 let s = Ember.$('<style></style>');99 s.html(collection);100 head.append(s);101 }...
inkPen.ts
Source:inkPen.ts
...43 const hex = Math.round(color / 1.2 ** amount).toString(16);44 return hex.length === 1 ? `0${hex}` : hex;45 };46 await inkedRole.setColor(47 `#${darkenColor(r, 4)}${darkenColor(g, 4)}${darkenColor(b, 4)}`48 );49 await target.roles.add(inkedRole);50 await interaction.reply(`${target} has been inked!`);51 inked = true;52 await wait(1000 * 60);53 await inkedRole.setColor(54 `#${darkenColor(r, 3)}${darkenColor(g, 3)}${darkenColor(b, 3)}`55 );56 await wait(1000 * 60);57 await inkedRole.setColor(58 `#${darkenColor(r, 2)}${darkenColor(g, 2)}${darkenColor(b, 2)}`59 );60 await wait(1000 * 60);61 await inkedRole.setColor(62 `#${darkenColor(r, 1)}${darkenColor(g, 1)}${darkenColor(b, 1)}`63 );64 await wait(1000 * 60);65 await target.roles.remove(inkedRole);66 inked = false;67}68export const commandData: ApplicationCommandData = {69 name: 'ink-pen',70 description: 'Darkens someone with some ink',71 defaultPermission: false,72 options: [73 {74 name: 'target',75 description: 'The person to be inked at',76 type: 'USER',...
Using AI Code Generation
1import { darkenColor } from 'storybook-root';2import { darkenColor } from 'storybook-root';3import { darkenColor } from 'storybook-root';4import { darkenColor } from 'storybook-root';5import { darkenColor } from 'storybook-root';6import { darkenColor } from 'storybook-root';7import { darkenColor } from 'storybook-root';8import { darkenColor } from 'storybook-root';9import { darkenColor } from 'storybook-root';10import { darkenColor } from 'storybook-root';11import { darkenColor } from 'storybook-root';12import { darkenColor } from 'storybook-root';13import { darkenColor } from 'storybook-root';14import { darkenColor } from 'storybook-root';15import { darkenColor } from 'storybook-root';16import { darkenColor } from 'storybook-root';17import { darkenColor } from 'storybook-root';18import { darkenColor } from 'storybook-root';19import { darkenColor } from 'storybook-root';20import { darkenColor } from 'storybook-root';
Using AI Code Generation
1import { darkenColor } from 'storybook-root';2import { darkenColor } from '@storybook-root';3import { darkenColor } from '@storybook-root/storybook-root';4import { darkenColor } from 'storybook-root/storybook-root';5import { darkenColor } from 'storybook-root/dist/storybook-root';6import { darkenColor } from '@storybook-root/dist/storybook-root';7import { darkenColor } from 'storybook-root/dist';8import { darkenColor } from '@storybook-root/dist';9import { darkenColor } from '@storybook-root/dist/storybook-root';10import { darkenColor } from 'storybook-root/dist/storybook-root';11import { darkenColor } from '@storybook-root/dist';12import { darkenColor } from 'storybook-root/dist';13import { darkenColor } from '@storybook-root/dist';14import { darkenColor } from '@storybook-root/dist/storybook-root';15import { darkenColor } from 'storybook-root/dist/storybook-root';16import { darkenColor } from 'storybook-root/dist';17import { darkenColor } from '@storybook-root/dist';18import { darkenColor } from 'storybook-root/dist';19import { darkenColor } from '@storybook-root/dist';20import { darkenColor } from '@storybook-root/dist/storybook-root';21import { darkenColor } from 'storybook-root/dist/storybook-root';
Using AI Code Generation
1import { darkenColor } from 'storybook-root';2darkenColor('red', 0.5);3import { darkenColor } from 'storybook-root/src/utils/colorUtils';4darkenColor('red', 0.5);5export const darkenColor = (color, darken) => {6};
Using AI Code Generation
1import { darkenColor } from 'storybook-root';2const newColor = darkenColor('red', 10);3import { darkenColor } from 'storybook-root';4export { darkenColor };5export const darkenColor = (color, amount) => {6};
Using AI Code Generation
1import { darkenColor } from 'storybook-root';2const color = darkenColor('#fff', 0.2);3console.log(color);4import { darkenColor } from 'storybook-root';5const color = darkenColor('#fff', 0.2);6console.log(color);7import { darkenColor } from 'storybook-root';8const color = darkenColor('#fff', 0.2);9console.log(color);10import { darkenColor } from 'storybook-root';11const color = darkenColor('#fff', 0.2);12console.log(color);13import { darkenColor } from 'storybook-root';14const color = darkenColor('#fff', 0.2);15console.log(color);16import { darkenColor } from 'storybook-root';17const color = darkenColor('#fff', 0.2);18console.log(color);19import { darkenColor } from 'storybook-root';20const color = darkenColor('#fff', 0.2);21console.log(color);22import { darkenColor } from 'storybook-root';23const color = darkenColor('#fff', 0.2);24console.log(color);25import { darkenColor } from 'storybook-root';26const color = darkenColor('#fff', 0.2);27console.log(color);28import { darkenColor } from 'storybook-root';29const color = darkenColor('#fff', 0.2);30console.log(color);31import { darkenColor } from 'storybook-root';32const color = darkenColor('#
Using AI Code Generation
1import { darkenColor } from 'storybook-root'2const color = darkenColor('#ffffff', 0.5)3console.log(color)4import { lightenColor } from 'storybook-root'5const color = lightenColor('#ffffff', 0.5)6console.log(color)7import { getContrast } from 'storybook-root'8const color = getContrast('#ffffff', '#000000')9console.log(color)10import { getLuminance } from 'storybook-root'11const color = getLuminance('#ffffff')12console.log(color)13import { getBrightness } from 'storybook-root'14const color = getBrightness('#ffffff')15console.log(color)16import { isDark } from 'storybook-root'17const color = isDark('#ffffff')18console.log(color)19import { isLight } from 'storybook-root'20const color = isLight('#ffffff')21console.log(color)22import { isColor } from 'storybook-root'23const color = isColor('#ffffff')24console.log(color)25import { isHex } from 'storybook-root'26const color = isHex('#ffffff')27console.log(color)28import { isRgb } from 'storybook-root'29const color = isRgb('rgb(255,255,255)')30console.log(color)31import { isRgba } from 'storybook-root'
Using AI Code Generation
1import { darkenColor } from 'storybook-root'2const color = darkenColor('#fff', 0.2)3console.log(color)4import tinycolor from 'tinycolor2'5export const darkenColor = (color, amount) => {6 return tinycolor(color)7 .darken(amount * 100)8 .toString()9}10{11}12import tinycolor from 'tinycolor2'13export const darkenColor = (color, amount) => {14 return tinycolor(color)15 .darken(amount * 100)16 .toString()17}18{19}20import tinycolor from 'tinycolor2'21export const darkenColor = (color, amount) => {22 return tinycolor(color)23 .darken(amount * 100)24 .toString()25}26{27}28import tinycolor from 'tinycolor2'29export const darkenColor = (color, amount) => {30 return tinycolor(color)31 .darken(amount * 100)32 .toString()33}34{35}36import tinycolor from 'tinycolor2'37export const darkenColor = (color, amount) => {38 return tinycolor(color)39 .darken(amount * 100)40 .toString()41}42{43}44import tinycolor from 'tinycolor2'
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!