How to change Twitter widgets font size or color?

by Peter Moss 1. March 2010 09:55

Twitter was nice enough to provide us with a Javascript JSON widget to retrieve one's public timeline.

Twitter widget constructor has a bunch of parameters that you can change to customize the look and feel of your widget.

However one critical, in my opinion, element was left out and remains hardcoded. Font definition should have been exposed in the widget construction, or at least the CSS classes should have been properly documented.

Here is how the twitter widget can be invoked:

<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
      version: 2,
      type: 'profile',
      rpp: 4,
      interval: 4000,
      width: 'auto',
      height: 150,
      theme: {
         shell: {
         background: '#ffffff',
         color: '#000000'
       },
      tweets: {
         background: '#ffffff',
         color: '#000000',
         links: '#0707eb'
      }
   },
   features: {
      scrollbar: false,
      loop: true,
      live: false,
      hashtags: true,
      timestamp: true,
      avatars: false,
      behavior: 'default'
   }
}).render().setUser('2PeterMoss').start();
</script>


I have looked at their cryptic code in widget.js and pulled out the CSS class that needs to be changed.

To change the font of your tweets you have to change the following CSS class:

   .twtr-tweet-text {
    font size: 105%;
    font-family: Georgia, Serif;
    }


There are other CSS classes that can be modified:

   .twtr-hyperlink
   .twtr-atreply
   .twtr-hashtag
   .twtr-tweet-wrap
   .twtr-avatar
   .twtr-img


The above twitter widget works but there is a cleaner solution on code.google.com site.
At least this one provides you with a nice css and Javascript code that is easier on your eyes :-)

Tags:

AJAX | Javascript

Comments

3/26/2010 3:17:43 PM #

Exactly what I was looking for!  A big thanks to you sir!!!

Patrick | Reply

4/7/2010 5:07:03 PM #

Hello Peter, can you PLEASE tell me how I even get to the place to enter the code?  Every time I type in "how to change Twitter's font size" I get information on changing the font size in Wordpress or downloading wordpress plugins, or changing the .CSS file where is this stuff located?

I am using windows xp/ Firefox browser.

Paula | Reply

4/20/2010 4:17:08 PM #

What I did was grab the widget.js & widget.css files and put them on my server. That way I can manipulate the two files to do whatever I want.

I am in the process of designing a tweet wall using the Twitter search widget js file but can only get one line of column(s) to show at the moment.

LJ Webster | Reply

5/6/2010 8:46:08 AM #

Starting to understand a bit more now... Thanks for keeping it simple!

Barry Hertz | Reply

Add comment




biuquote
  • Comment
  • Preview
Loading