?
Solved

changing colour of font and background

Posted on 2000-04-18
1
Medium Priority
?
286 Views
Last Modified: 2013-12-03
Hi there..

I'm trying to change the colour of the background and font using C in Linux. I was using ncurses  to do this, but if there's an easier way (perhaps using vagal??) I'm interested...

I had something like this:

start_colour();

init_pair(COLORPAIRS-1, COLOR_GREY, COLOR_GREEN);

I know this alone won't do it.. I think I need to use wattrset, but I'm not sure of it's arguments (set to specified window?!). Also, what's the first argument of init_pair for? (couldn't follow the man page..)  Am I on the right track with this? Do I need to use printw instead of printf now for everything?

Also, is it possible to change font size from here?

Cheers,
  Gavin
0
Comment
Question by:teatowel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
fremsley earned 375 total points
ID: 2726882
You could send the control sequences directly to the console / terminal. The easiest way would be to hard-code the ANSI sequences (like <ESC>[42m) into your program, but to stay platform-independent I recommend getting the terminal type from the $TERM variable and parse the corresponding entry in the /etc/termcap (man termcap).

Of couse this is quite a bit of work, on the other hand you do not have to link your applications with a large library when you only need this single functionality.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question