512e07dc304480bdf647f57c09439b66.json 2.49 KB
{"ast":null,"code":"import { TinyColor } from './index';\nimport { convertToPercentage } from './util';\n/**\n * If input is an object, force 1 into \"1.0\" to handle ratios properly\n * String input requires \"1.0\" as input, so 1 will be treated as 1\n */\n\nexport function fromRatio(ratio, opts) {\n  var newColor = {\n    r: convertToPercentage(ratio.r),\n    g: convertToPercentage(ratio.g),\n    b: convertToPercentage(ratio.b)\n  };\n\n  if (ratio.a !== undefined) {\n    newColor.a = Number(ratio.a);\n  }\n\n  return new TinyColor(newColor, opts);\n}\n/** old random function */\n\nexport function legacyRandom() {\n  return new TinyColor({\n    r: Math.random(),\n    g: Math.random(),\n    b: Math.random()\n  });\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/@ctrl/tinycolor/dist/module/from-ratio.js"],"names":["TinyColor","convertToPercentage","fromRatio","ratio","opts","newColor","r","g","b","a","undefined","Number","legacyRandom","Math","random"],"mappings":"AAAA,SAASA,SAAT,QAA0B,SAA1B;AACA,SAASC,mBAAT,QAAoC,QAApC;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAmBC,KAAnB,EAA0BC,IAA1B,EAAgC;AACnC,MAAIC,QAAQ,GAAG;AACXC,IAAAA,CAAC,EAAEL,mBAAmB,CAACE,KAAK,CAACG,CAAP,CADX;AAEXC,IAAAA,CAAC,EAAEN,mBAAmB,CAACE,KAAK,CAACI,CAAP,CAFX;AAGXC,IAAAA,CAAC,EAAEP,mBAAmB,CAACE,KAAK,CAACK,CAAP;AAHX,GAAf;;AAKA,MAAIL,KAAK,CAACM,CAAN,KAAYC,SAAhB,EAA2B;AACvBL,IAAAA,QAAQ,CAACI,CAAT,GAAaE,MAAM,CAACR,KAAK,CAACM,CAAP,CAAnB;AACH;;AACD,SAAO,IAAIT,SAAJ,CAAcK,QAAd,EAAwBD,IAAxB,CAAP;AACH;AACD;;AACA,OAAO,SAASQ,YAAT,GAAwB;AAC3B,SAAO,IAAIZ,SAAJ,CAAc;AACjBM,IAAAA,CAAC,EAAEO,IAAI,CAACC,MAAL,EADc;AAEjBP,IAAAA,CAAC,EAAEM,IAAI,CAACC,MAAL,EAFc;AAGjBN,IAAAA,CAAC,EAAEK,IAAI,CAACC,MAAL;AAHc,GAAd,CAAP;AAKH","sourcesContent":["import { TinyColor } from './index';\nimport { convertToPercentage } from './util';\n/**\n * If input is an object, force 1 into \"1.0\" to handle ratios properly\n * String input requires \"1.0\" as input, so 1 will be treated as 1\n */\nexport function fromRatio(ratio, opts) {\n    var newColor = {\n        r: convertToPercentage(ratio.r),\n        g: convertToPercentage(ratio.g),\n        b: convertToPercentage(ratio.b),\n    };\n    if (ratio.a !== undefined) {\n        newColor.a = Number(ratio.a);\n    }\n    return new TinyColor(newColor, opts);\n}\n/** old random function */\nexport function legacyRandom() {\n    return new TinyColor({\n        r: Math.random(),\n        g: Math.random(),\n        b: Math.random(),\n    });\n}\n"]},"metadata":{},"sourceType":"module"}