The visual style of a programmer

Recently I heard a person say that us “geeks” don’t have a good sense of style, presumably because we typically wear very plain clothes (check pictures of Steve Jobs or Mark Zuckerberg), however, what I think many people don’t see is that we do have style, but where it matters; our computer screens, not clothes.

Most of the time a programmer is staring at code, and the program that shows code and allows you to edit it properly is called a text editor.

This is vim, one of the most popular text editors for programmers with the default configuration.

By default it works, however, staring at these colors for hours gets tedious; I want better colors. Fortunately vim has the concept of “color schemes”, so you have several hundreds of themes to choose.

After trying tons of those, I decided none were exactly what I wanted, so I decided to create my own.

Color theory

I have been choosing colors for websites for about 20 years, so I am familiar with the ways colors are programmed, but many people are not.

While sometimes you can tell a program “red” and it will use the right color, sometimes you need a slightly darker red, or something between orange and red. So in order to be perfectly specific, the most common system to tell a computer a color is called RGB (red, green, blue). In this system, red is 100%, 0%, 0% (100% of the red component), green would be 0%, 100%, 0%, and yellow (which is a combination of red and green), 100%, 100%, 0%.

But computers don’t naturally deal with percentages; they are digital, so they need concrete numbers, which is why 100% is translated to 255 (the maximum value), thus 50% would be 128. And they don’t even use the decimal system; they use binary, and the closest between decimal and binary is hexadecimal, in which 255 is “FF”. Just like in decimal 9 is the biggest digit (1 less than 10), in hexadecimal F is the biggest digit representing 15 (1 less than 16).

So, red in hexadecimal RGB (the standard) is “FF0000”.

I can do the translation in my mind between many hexadecimals to their corresponding human colors, and do some alterations, like for example making an orange more red, or make a cyan darker, or less saturated.

This method of selecting colors has served me well for several years, and I have created aesthetically pleasing colors for many interfaces, but it’s always trial and error, and although the colors look OK, I could never be sure if they are precisely what I wanted.

For example if yellow is “FFFF00” (100% red and 100% green), I could figure out orange would be “FF8000” (50% green). But for more complicated colors, like a light red “FF8080”–where green is already halved–it’s not so clear how to combine it with a light yellow “FFFF80” where green is full, or how to make a purple that looks similar.

I wanted a programmatically precise method of generating the colors I wanted, and in order to do that I researched about color wheels and learned that in fact there’s many systems of colors, and many different color wheels.

What I wanted was a way to generate the RGB color wheel, but without using the RGB color model. It turns out there’s two alternate representations of the RGB model; HSL (hue, saturation, lightness) and HSV (hue, saturation, value). I was familiar with HSV, but it turns out HSL is the one that better serves my purposes.

In HSL red is 0°, 100%, 50%, yellow is 60°, 100%, 50%, orange is 30°, 100%, 50%; the saturation and lightness are not changing, only the hue. So now it’s clear how to generate the light orange, since light red is 0°, 100%, 75%, light yellow is 60°, 100%, 75%, so obviously light orange is 30°, 100%, 75%.

I can easily generate the full color wheel by simply changing the hue: red 0°, orange 30°, yellow 60°, chartreuse green 90°, green 120°, spring green 150°, cyan 180°, azure 210°, blue 240°, violet 270°, magenta 300°, rose 330°.

My color scheme

I have been using my own color scheme for about 10 years, but armed with my new-found knowledge, I updated the colors.

I cannot stress enough how incredibly different this looks to my eyes, especially after hours of programming.

These are the colors I ended up picking.

Is this not style?

If you are a programmer using vim, here’s my color scheme: felipec.

Font

But wait, there’s more. Colors are part of the equation, but not the whole. When reading so much text it’s important in what font that text is rendered.

Generally speaking there’s three kinds of typefaces, “serif”, “sans-serif”, and “monospace”. The kind virtually everyone uses for code is monospace, which looks like: this.

There’s tons of different monospace fonts, many created specifically to read code. In fact, there’s even sites that allow you to compare code in different programming languages with different fonts to see which one you like best, for example: Coding Fonts.

It’s this way I found my new favorite coding font: Input. Not only has the font been carefully designed, but it can be configured to accommodate different preferences, such as the shape of the letter “g”, which I decided to change. You can play with different preferences and preview how it looks in different languages (and in fact different vim color schemes).

This is what it looks like:

Probably most people don’t notice the difference between the DejaVu and Input fonts, but I do, and plenty of programmers do too, which is why these fonts were created in the first place.

There there

So there is it, just because most people don’t see it, doesn’t mean there’s no there there.

Programmers do have style. It’s just that we care more about the color of a conditional more than we do about the color of our shirt.

Unique Mexican music; Son Jarocho, folklore and more

There’s a lot of interesting and unique music in Mexico, both modern and traditional, but there’s one kind that I find particularly unique and beautiful that I think it’s extremely underrated in Mexico, let alone in the world; Son Jarocho.

This first video is from Cafe Tacuba, IMO the best band from Mexico, although I’m not sure what kind of style it is, it’s certainly awesome 🙂 (I couldn’t find a better video quality)

The rest of the videos are of what I consider Son Jarocho in the right setting; small room, 3 guys; jarana jarocha (small guitar), requinto jarocho (even smaller guitar), and more importantly; arpa jarocha (a special harp). It’s a mixture of different styles from different continents, and the lyrics are often funny and sometimes improvised to make fun of something, or somebody. BTW, jarocho means from Veracruz, one of the 31 states of Mexico.

La Bamba is the most famous one, but I couldn’t find one video worthy of highlighting, so I just put the best one I could find. And before you ask, yes, the high pitch and loud voices in the chorus are intended, also, wait for the solos 😉

This is what you most likely would expericence; a group wandering around restaurants, improvising and making jokes.

This one seems professionally recorded. Just for measure.

For more more about Mexican music and culture, check this previous post.

Announcing codeswarm.rb 0.1

codeswarm.rb is a rewrite of Michael Ogawa’s code_swarm in ruby using cairo.

For an example see:

The format of the events xml file is compatible with code_swarm’s one,
and the physics engine is basically the same.

The code is less than 500 lines of code, so it should be fairly hackable.

The code is there:
http://github.com/felipec/codeswarm.rb

And here is a picture (youtube is too blurry):
screenshot-codeswarmrb

Get to know a little bit more about Mexican culture

Until a few years I have lived all my life in Mexico, then about one year in USA and now six months in Finland. After these experiences I have the felling that most people don’t really know much about it, some almost nothing.

Today is Mexico’s independence day, so I figured it would be a good idea to write about my country.

I guess the stereotype of Mexican people is that we like tequila, dance a salsa, we are lazy and our best beer is Corona.

Most people get surprised by this one: Corona is far from being the best beer, they just did good marketing. To my understanding it is one of the cheapest and it’s popular in “beach cities” or small towns, but otherwise it’s just another beer, and definitively not the best. My friends would buy Indio, Sol, Tecate Light, XX Lager, Heineken, Casta, anything but Corona.

For a complete list of international ratings you can check FEMSA list, Grupo Modelo list and there’s more

Now, Mexico is drastically different from one place to another. We have deserts, amazing beaches, forests and jungles. Huge cities, towns and indigenous communities. Filthy rich people (like Carlos Slim, the richest person in the world) and very poor. It’s really difficult to say that Mexico is some way, because it really depends a lot.

What is worst. We Mexicans don’t know each other so well. It’s not unusual to leave a Mexican wondering about some fact of the country. There are 31 states, and each state is totally different.

So if you think Mexican drink tequila you should think again. Some Mexicans call themselves “tequilero” (they like it), some are more beer people, and some like other liquors. In my city (Monterrey) we mostly drink beer and tequila just in special occasions or mixed with something else.

The same goes for dancing Salsa. A lot of people from “beach cities” dance it, but it’s not so popular anywhere else. Each zone has its own distinct type of dancing. There’s Cumbia Tejana, Cumbia Norteña, Quebradita, Pacito Duranguense, Banda, etc.

The one that I find most amusing is that we are lazy. In some way that’s true; we like to take shortcuts. We like to think about ourselves as “creative” people that often do things the “wrong” way. Some classic example is to quickly “fix” a car’s broken front light with some plastic and scotch tape, sometimes for the lack of money, but other times it’s for the lack of time. We don’t spend so much time finding the proper solution. That has advantages and drawbacks but that’s how we are.

We usually work more than 8 hours a day, a lot of people work on Saturdays and even Sundays, the concept of extra time is almost inexistent, we don’t get any vacation days on the first year of work, and after that is about 10 days per year.

On the contrary, we are very hard-working people, and specially the people on the north.

Something that most people fail to see is our sense of humour. We make fun about everything all the time, but usually in a way of puns which heavily rely on our own Mexican variant of Spanish.

Language and humor are intensely correlated. For example: a very common word is chingada (fuck/screw), which comes from La Malinche the mistress of Hernan Cortes which is considered a traitor who screwed us. Nowadays most Mexicans don’t know where “chingada” comes from, it probably started as a joke which eventually made into the common language, and now it’s still used as a word that can be used almost anywhere and makes the comment more funny.

There’s also albur. Which I don’t want to try to explain, but it’s some very specific kind of pun joke which is persistent in the whole country and even among different social classes.

We even make fun about the death. We have a special Day of the Dead in which we remember our lost beloved ones and think about them as if they came back this day to live with the living. The tradition says that we should put some altar with offerings; things they liked in life. In some towns they even make parties. Also some people write “calaveras” (skulls), which are mocking epitaphs for friends (living friends), as a story about how the death takes them away, with rhymes and puns, but most importantly something quintessential about the person.

Almost everything is allowed: death, corruption, racism, sexism, wifes, sisters, even Mexican people… but not mothers, that’s really touchy.

It’s not a big surprise that Mexican humor is not very well known: it’s too local, and maybe offensive. But lately there have been a few Mexican comedians that have been able to succeed in USA, and they are quite good: George Lopez, Pablo Francisco and Paul Rodriguez.

Funny enough the Mexican-American comedians almost unknown in Mexico.

The food? There’s no Mexican food outside of Mexico. What is supposed to be “Mexican cousine” is actually Tex-Mex at best. Nachos and Fajitas are purely Tex-Mex; Fajitas are almost unknown in Mexico.

Typical examples of Mexican cuisine include: pozole, tamales, carnitas and mole. If there isn’t any typical drink as horchata, jamaica or tamarindo then it’s probably not Mexican cuisine.

Tortillas must be warm, that’s why they are kept inside “tortilleros” (tortilla warmers), and food is usually served without tortillas so when you are ready to use one you take it out of the tortillero. Typical tortillas are about 15 cm.

Again, the typical food varies drastically from region to region. For a list of more Mexican food check here.

And finally there’s music. Again, a lot of different kinds:

Café Tacuba – Ojalá que llueva Café

El Gran Silencio – Cumbia Lunera (live from Japan)

Celso Piña – Cumbia sobre el Rio

Kinky – Coqueta (with cowbell!)

(I’m listing examples of the ones I like that I think are typical but there are many many more).

Our race and our culture is metiza; a mixture from European and indigenous which is very rich and diverse. Drastically different from one place to another is a living example that different cultures can live together peacefully. It’s far from being a paradise; there are huge problems as corruption, poverty and ignorance, but Mexican people are positive, and although slowly, there’s improvement.