Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

82
Vistas
Core scaling in javascript equal to Excel

I need a logic that handles color gamut for any color.

I started by trying to work with the color red. I have a date column and the older the date, the redder the color needs to be. So that's basically it, the date of a day ago for example would have a lighter red and as the time passes it gets darker.

This was my attempt:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
  <!-- Bootstrap CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
    integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

</head>

<body>
  <div id="id">
    <div class="table-responsive">
      <table class="table table-striped w-auto">
        <thead>
          <tr>
            <th>Due Data</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td v-bind:style="'background-color: rgb('+255/3*getLateDays('2022-07-08')+',0,0)'">2022-07-08</td>
          </tr>
          <tr>
            <td v-bind:style="'background-color: rgb('+255/3*getLateDays('2022-07-09')+',0,0)'">2022-07-09</td>
          </tr>
          <tr>
            <td v-bind:style="'background-color: rgb('+255/3*getLateDays('2022-07-10')+',0,0)'">2022-07-10</td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
  </div>
</body>
<script>
  var myApp = new Vue({
    el: '#id',
    data() {
      return {

      }
    },
    methods: {
      getLateDays(date) {
        return Math.ceil((new Date().setHours(0, 0, 0, 0) - new Date(date + ' 00:00:00').setHours(0, 0, 0, 0)) / (1000 * 60 * 60 * 24));
      }
    },
  });
</script>

</html>

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda