Skip to content

Instantly share code, notes, and snippets.

@domagude
Last active October 28, 2017 16:19

Revisions

  1. domagude revised this gist Oct 28, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions style.js
    Original file line number Diff line number Diff line change
    @@ -17,11 +17,11 @@ $(document).on('turbolinks:load', function() {
    }


    $('#feed').on( 'mouseenter', '.single_post', function() {
    $('#feed').on( 'mouseenter', '.single-post-list', function() {
    $(this).css('border-color', randomColor());
    });

    $('#feed').on( 'mouseleave', '.single_post', function() {
    $('#feed').on( 'mouseleave', '.single-post-list', function() {
    $(this).css('border-color', 'rgba(0, 0 , 0, 0.05)');
    });

  2. domagude revised this gist Oct 28, 2017. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions style.js
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    $(document).on('turbolinks:load', function() {
    if ($(".single-post-card").length) {
    // set solid background color style
    // set a solid background color style
    if (mode == 1) {
    $(".single-post-card").each(function() {
    $(this).addClass("solid-color-mode");
    $(this).css('background-color', randomColor());
    });
    }
    // set border color style
    // set a border color style
    else {
    $(".single-post-card").each(function() {
    $(this).addClass("border-color-mode");
    @@ -30,6 +30,7 @@ $(document).on('turbolinks:load', function() {
    var colorSet = randomColorSet();
    var mode = Math.floor(Math.random() * 2);

    // Randomly returns a color scheme
    function randomColorSet() {
    var colorSet1 = ['#45CCFF', '#49E83E', '#FFD432', '#E84B30', '#B243FF'];
    var colorSet2 = ['#FF6138', '#FFFF9D', '#BEEB9F', '#79BD8F', '#79BD8F'];
    @@ -42,7 +43,8 @@ function randomColorSet() {
    return randomSet[Math.floor(Math.random() * randomSet.length )];
    }

    // Randomly returns a color from an array of colors
    function randomColor() {
    var randomColor = colorSet[Math.floor(Math.random() * colorSet.length)];
    return randomColor;
    var color = colorSet[Math.floor(Math.random() * colorSet.length)];
    return color;
    }
  3. domagude created this gist Oct 28, 2017.
    48 changes: 48 additions & 0 deletions style.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    $(document).on('turbolinks:load', function() {
    if ($(".single-post-card").length) {
    // set solid background color style
    if (mode == 1) {
    $(".single-post-card").each(function() {
    $(this).addClass("solid-color-mode");
    $(this).css('background-color', randomColor());
    });
    }
    // set border color style
    else {
    $(".single-post-card").each(function() {
    $(this).addClass("border-color-mode");
    $(this).css('border', '5px solid ' + randomColor());
    });
    }
    }


    $('#feed').on( 'mouseenter', '.single_post', function() {
    $(this).css('border-color', randomColor());
    });

    $('#feed').on( 'mouseleave', '.single_post', function() {
    $(this).css('border-color', 'rgba(0, 0 , 0, 0.05)');
    });

    });

    var colorSet = randomColorSet();
    var mode = Math.floor(Math.random() * 2);

    function randomColorSet() {
    var colorSet1 = ['#45CCFF', '#49E83E', '#FFD432', '#E84B30', '#B243FF'];
    var colorSet2 = ['#FF6138', '#FFFF9D', '#BEEB9F', '#79BD8F', '#79BD8F'];
    var colorSet3 = ['#FCFFF5', '#D1DBBD', '#91AA9D', '#3E606F', '#193441'];
    var colorSet4 = ['#004358', '#1F8A70', '#BEDB39', '#FFE11A', '#FD7400'];
    var colorSet5 = ['#105B63', '#FFFAD5', '#FFD34E', '#DB9E36', '#BD4932'];
    var colorSet6 = ['#04BFBF', '#CAFCD8', '#F7E967', '#A9CF54', '#588F27'];
    var colorSet7 = ['#405952', '#9C9B7A', '#FFD393', '#FF974F', '#F54F29'];
    var randomSet = [colorSet1, colorSet2, colorSet3, colorSet4, colorSet5, colorSet6, colorSet7];
    return randomSet[Math.floor(Math.random() * randomSet.length )];
    }

    function randomColor() {
    var randomColor = colorSet[Math.floor(Math.random() * colorSet.length)];
    return randomColor;
    }