EzDevInfo.com

colorize

Ruby string class extension. It add some methods to set color, background color and text effect on console easier using ANSI escape sequences. Documentation for fazibear/colorize (master)

Does R have an add-on to colorize scripts?

I am new to the R language, but not to the programming world. I have been using excellent code editors such as Notepad++ and Eclipse and, therefore, am used to colored codes.

Is there any thing that can be done to colorize the scripts inside R?

I know I can use Notepad++; however, this will require going back and forth between the two software, which is not convenient.

Thank you.


Source: (StackOverflow)

Colorize code inside [closed]

I'm looking for a open source PHP script to colorize the code inside

<code></code> 

or

[code][/code] tags.

Thanks


Source: (StackOverflow)

Advertisements

PHP: color overlay with Hue blend mode

Can anyone tell me how in PHP, I can do the same effect as in Adobe Photoshop - Color overlay->Blend mode:Hue

This thing colorizes all colorful pixels (non-grascale ones). I need it for my project - http://iconizer.net . I managed to make the colorisation, but it paints the gray shadows too. I need shadows and other grayscale pixels to be left untouched. I can do it with pixel-by-pixel scanning, but it's crazy. There has got to be a simpler solution. Does anyone know it?

Thanks in advance.


Source: (StackOverflow)

"Colorizing" images in .NET

Is there any simple way to programatically colorize images in .NET? Basically we have a black and white image and need to put a layer of say pink above it and reduce the opacity of that layer to make the picture colorized in pink.


Source: (StackOverflow)

Colorized REPL for Common Lisp

I was wondering if there is a way to colorize a Common Lisp REPL. Although terminfo seems to lay some groundwork for that, I've yet to find a library that actually uses it for coloring. Has someone done it already? Vim plugins and implementation-specific libraries (such as linedit for SBCL) are welcome.

PS: I am aware of Emacs, and would prefer a Vim alternative if the solution has to be wrapped inside an editor. My preference of SBCL against CLISP, on the other hand, isn't as critical.


Source: (StackOverflow)

HTML5 Canvas: Colorize image

I would like to change the color of the image/canvas. My existing code:

var loader = new PxLoader()
var image = loader.addImage('images/balloon.png')
loader.addCompletionListener(functio() {
  var canvas = $("<canvas>").attr("width", "200").attr("height", "200");
  var context = canvas[0].getContext('2d');
  context.clearRect(0, 0, 200, 200);
  context.drawImage(image, 0, 0);
  // colorize??????
});

How can I colorize it - further manipulation of the context (I would like to use Pixastic.process if possible)?


Source: (StackOverflow)

What's a good Wordpress extension for coloring C/C++/script code? [closed]

My research group uses a Wordpress blog. Frequently I want post snippets or even entire short programs I've been working on to it, with most of my code being written in C/C++ or scripting languages (Bash, TCL, etc).

I figure that there have to be some good extensions to Wordpress to colorify code since so many people use it. I'm looking for something similar to StackOverflow's colorizing system, though I realize it may not be quite as robust!

Can you point me to some of your favorites/the ones you think are most reliable?

Thanks in advance!


Source: (StackOverflow)

Invoke grc terminal colorizer on ALL commands implicitly

I love the grc colorizer for the terminal. However I have to explicitly prefix anything I want colorized with:

grc --config=conf.mine

Is there any way to have it automatically applied to everything you input on the command line (so that potentially I don't even need to know what grc is)? Perhaps using shell hooks, if a better alternative doesn't exist?


Source: (StackOverflow)

Recoloring image ads to match website theme

What would be the best method of going about doing this? I want to essentially apply a photoshop-esque color overlay of image ads on a website. Preferably through CSS, but javascript would work too. My first idea was placing a div with the color I intend with the same width and height as the ad div, and applying an opacity setting to it so that it blends together. Thoughts?


Source: (StackOverflow)

In Sublime Text 2 is there a tool to "colorize" git add/deletes in a COMMIT_EDITMSG file?

When I git commit, I do a $ gcv which is an alias in my .bash_profile for git commit -v. The information in that file is great. I like to review what I did so I can make a concise message.

Recently, I figured out how to "colorize" my git output in iTerm2 and it's beautiful. My brain has gotten used to quickly identifying the red and green so I can see the adds and deletes very easily.

Question is: I can see my COMMIT_EDITMSG file in Sublime, but can I get it to open with the same colorized lines I'm seeing in iTerm2?


Source: (StackOverflow)

Is it possible to programmatically colorize an image? [closed]

In my "wildest dreams," I would like to pass an image to a method like so (pseudoC#):

string pathToOriginalImg = @"http://commons.wikimedia.org/wiki/File:Mark_Twain_by_AF_Bradley.jpg";
Image colorizedImg = new ColorizeImage(pathToOriginalImg, [array of colors]);

IOW, pass the path of an image to be colorized to a method, along with an array of colors you want to be used in the colorization. For example, if I wanted to "Spanishize" this image of Mark Twain, I might want to pass it the colors of the flags of Spain and Mexico, something like: Forest Green, White, MexicanRed; SpanishRed, Yellow.

Is this possible, or am I one log short of a cabin in even wishing for such?


Source: (StackOverflow)

Colourise CGContextRef But Preserve Alpha

I have a CGContextRef and can draw on it and specify the alpha, and if I try and use it it works perfectly. However, I am trying to colourise it (currently either red or green), but whatever blend mode I choose, the alpha is set to 1 (because I am drawing with alpha as 1). Drawing it the correct colour is not really a viable option, as I would like to be able to colour UIImages loaded from the filesystem as well, so how should I achieve this?

Edit: Example code (width and height are predefined floats, points is an array of CGPoints all of which lie inside the context and color is a UIColor with an opacity of 100%) -

UIGraphicsBeginImageContext(CGSizeMake(width,height));

CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextClearRect(contextRef, CGRectMake(0.0f, 0.0f, width, height));
CGContextSetRGBStrokeColor(contextRef, 0.0f, 0.0f, 0.0f, 1.0f);
CGContextSetRGBFillColor(contextRef, 1.0f, 1.0f, 1.0f, 1.0f);
CGContextSetLineWidth(contextRef, lineWidth);

CGContextBeginPath(contextRef);
CGContextMoveToPoint(contextRef, points[0].x, points[0].y);
for (int i = 1; i < 4; i++) {
    CGContextAddLineToPoint(contextRef, points[i].x, points[i].y);
}
CGContextAddLineToPoint(contextRef, points[0].x, points[0].y); // Encloses shape

CGContextDrawPath(contextRef, kCGPathFillStroke);

[color setFill];

CGContextBeginPath(contextRef);
CGContextSetBlendMode(contextRef, kCGBlendModeMultiply);
CGContextAddRect(contextRef, CGRectMake(0.0f, 0.0f, width, height));
CGContextDrawPath(contextRef, kCGPathFill);

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Thank you in advance for your help,
jrtc27


Source: (StackOverflow)

WPF DataGrid - Color cells if 1st, 2nd, or 3rd best value in that column's bound data

My DataGrid has specific columns that I want to apply a background color to the cell if the value is the 1st, 2nd, or 3rd best value for that column. The datatypes are all primitives, either string, int, byte, or double.

In my old VB project that used Winforms, I would do the following: - Loop through the columns and choose only those that I wanted to colorize; - For each column I would extract all distinct values from all rows of that cell; - I would sort the values and determine the top three values, either ascending or descending, based on my preference for that individual row; - I would loop through the columns again and color the cell background color if it matched one of the top three values. I used Yellow for first, LightGreen for second, and LightBlue for first.

I have found great examples of setting up a value converter but I do not know a good way to look at all of the data for that particular column. And WPF's DataGrid doesn't seem to allow you to access individual cells, as far as I can tell.

Am I wrong? Is there a way to do this?

Here's the 8-year old VB code for a WinForms grid for reference - it does a bit more than just colorize the cells. I can't find a good way to even get started in WPF to do this.

Private Sub ColorizeRows(ByRef dgv As DataGridView) ' Colorizes the rows Dim colors() As System.Drawing.Color = {Color.Yellow, Color.Orange, Color.LightBlue}

For Each column As DataGridViewColumn In dgv.Columns
  If column.Visible = True Then

    Dim vals() As Object = GetDistinctValuesFromColumn(dgv, column.Index)

    Select Case column.ToolTipText.ToLower()
      Case "d"
        For Each row As DataGridViewRow In dgv.Rows
          row.Cells(column.Index).Style.BackColor = dgv.Columns(column.Index).DefaultCellStyle.BackColor
        Next
        Dim lowCount As Integer = (vals.GetUpperBound(0) + 1) - 3
        If lowCount < 0 Then lowCount = 0
        For j As Integer = vals.GetUpperBound(0) To lowCount Step -1
          For Each row As DataGridViewRow In dgv.Rows
            If (Not (row.Cells(column.Index).FormattedValue Is DBNull.Value)) Then
              If CStr(row.Cells(column.Index).FormattedValue) = CStr(String.Format("{0:n1}", vals(j))) Then
                row.Cells(column.Index).Style.BackColor = colors(vals.GetUpperBound(0) - j)
              End If
            End If
          Next
        Next

      Case "a"
        ' First de-colorize the row
        For Each row As DataGridViewRow In dgv.Rows
          row.Cells(column.Index).Style.BackColor = dgv.Columns(column.Index).DefaultCellStyle.BackColor
        Next
        Dim lowCount As Integer = 2
        If lowCount > vals.GetUpperBound(0) Then lowCount = vals.GetUpperBound(0)
        For j As Integer = 0 To lowCount
          For Each row As DataGridViewRow In dgv.Rows
            If (Not (row.Cells(column.Index).FormattedValue Is DBNull.Value)) Then
              If CStr(row.Cells(column.Index).FormattedValue) = CStr(String.Format("{0:n1}", vals(j))) Then
                row.Cells(column.Index).Style.BackColor = colors(j)
              End If
            End If
          Next
        Next

      Case Else
        ' do nothing

    End Select

    ' Copy the highlighting rules from the EGB box to the EGL box if we're on the dgv
    If dgv.Name = "dgvRace" Then
      For i As Integer = 0 To dgv.Rows.Count - 1
        dgv.Rows(i).Cells("effGradeLetter").Style = dgv.Rows(i).Cells("effGradeLarge").Style
      Next
    End If

    ' Update all the tooltips for each box
    Dim places() As String = {"1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th"}
    For Each row As DataGridViewRow In dgv.Rows
      ' Update tooltiptext for each row
      Dim place As Integer = FindIndexInArray(vals, row.Cells(column.Index).FormattedValue)
      If place > -1 Then
        Dim placeStr As String = IIf(column.ToolTipText.ToLower() = "d", places(vals.GetUpperBound(0) - place), places(place))
        'If column.ToolTipText.ToLower() = "d" Then place = vals.GetUpperBound(0) - place
        row.Cells(column.Index).ToolTipText = String.Format("Column Place {0}", placeStr)
        If row.Cells(column.Index).Value.GetType().ToString() = "System.Single" Or row.Cells(column.Index).Value.GetType().ToString() = "System.Int32" Then
          ' Get upper/lower difference if available
          If place > 0 Then
            Dim distFromPlaceBefore As Single = Math.Abs(CSng(vals(place)) - CSng(vals(place - 1)))
            Dim distFromFirstPlace As Single = Math.Abs(CSng(vals(place)) - CSng(vals(0)))
            row.Cells(column.Index).ToolTipText &= ControlChars.CrLf & String.Format(" - Distance from {0}: {1:n1}; Distance from 1st: {2:n1}", places(place - 1), distFromPlaceBefore, distFromFirstPlace)
          End If
          If place < vals.GetUpperBound(0) Then
            Dim distFromPlaceAfter As Single = Math.Abs(Math.Round(CSng(vals(place)) - CSng(vals(place + 1)), 1))
            Dim distFromLastPlace As Single = Math.Abs(Math.Round(CSng(vals(place)) - CSng(vals(vals.GetUpperBound(0))), 1))
            row.Cells(column.Index).ToolTipText &= ControlChars.CrLf & String.Format(" - Distance from {0}: {1:n1}; Distance from {3}: {2:n1}", places(place + 1), distFromPlaceAfter, distFromLastPlace, places(vals.GetUpperBound(0)))
          End If
        End If
      End If

    Next

  End If
Next

UPDATE: Could I somehow attach the column and the source grid so I could get the values and get what I need to make the coloring decision?


Source: (StackOverflow)

Colorize ifort output

I know gcc produces colored output for the error messages. Does a similar feature exist in ifort as well ?


Source: (StackOverflow)

IMG_FILTER_COLORIZE problems

I already got some great advice on the forums how to get the colorize function using imagefilter IMG_FILTER_COLORIZE.

The problem is that it doesn't work as I want it to work, the link below illustrates it best: http://expromo.pl/klienci/imagefilter/

I have a transparent png containing some kind of shape. I want to:

  • Change the color of the shape just as Photoshop Layer Settings / Colorize would
  • Preserve the transparency
  • Save it as another PNG file

Here is my code:

$im = imagecreatefrompng('image.png');
imagealphablending($im, false);

if($im && imagefilter($im, IMG_FILTER_COLORIZE, 0,0,255,0))
{
    imagepng($im, 'image-new.png');
    imagedestroy($im);
}

On the link above: http://expromo.pl/klienci/imagefilter/

The first image is what I have. The second image is what I get, and the third image is what I want to get.

Big thanks in advance.


Source: (StackOverflow)