Sponsored Content
Full Discussion: Ncurses colors
Top Forums Programming Ncurses colors Post 302928571 by wisecracker on Friday 12th of December 2014 06:06:42 PM
Old 12-12-2014
Hi BillLee...

I am not familiar with ncurses but to get an extended range to the colours in the shell the __bold__ attribute has be on...

I assume that there is a BOLD attribute for ncurses...

This is an example, note the second loop might not work in some terminals...
Code:
#!/bin/bash
# colours.sh
n=0
for fg in {30..37}
do
	for bg in {40..47}
	do
		for bold in 0 1
		do
			# 1 = bold ON.
			printf "\x1B["$bold";"$bg";"$fg"m Line $n, bold = $bold, background = $bg, foreground = $fg...\x1B[0m\n"
			n=$((n+1))
		done
	done
done
for fg in {90..97}
do
	for bg in {100..107}
	do
		for bold in 0 1
		do
			# 1 = bold ON.
			printf "\x1B["$bold";"$bg";"$fg"m Line $n, bold = $bold, background = $bg, foreground = $fg...\x1B[0m\n"
			n=$((n+1))
		done
	done
done


Last edited by wisecracker; 12-12-2014 at 07:22 PM.. Reason: Added bold to the code.
These 2 Users Gave Thanks to wisecracker For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

ncurses/Darwin

I am using Darwin on Mac OS X.I.I (new to both Unix and C++). I downloaded the ncurses library from http://prdownloads.sourceforge.net/gnu-darwin/ncurses-5.2.tgz, but I don't know what to do with it now. Stuffit has expanded the archive, but I still have the original .tgz as well (if that's... (1 Reply)
Discussion started by: parmenides
1 Replies

2. Programming

ncurses -> the best way to use menus

hello there, i'm exploring the curses lib and i'm having some trouble with "defining a style". to clarify: i'm creating a menu driven app and i've been thinking what's the best way to use menus: make global vars (not my favourite), creating a function which designs the menu and returns the... (2 Replies)
Discussion started by: crashnburn
2 Replies

3. UNIX for Advanced & Expert Users

Using Ncurses for testing vi

Hi, Somebody has told me that NCurses can be used to test vi. But i was unable to figure out how. If anybody has done anything with NCurses please reply. Also is there any othre way by which we can test vi automatically? (2 Replies)
Discussion started by: rahulrathod
2 Replies

4. Programming

nCurses over telnet

hello all. my first post here :) i just want a little help. i have a small app tha uses ncurses for gui, and for user input. I need this app to be executed on a sever side, and have access to it through telnet. When i test it, i see that enter makes the hole gui move up, and some other... (0 Replies)
Discussion started by: tamtam
0 Replies

5. Linux

Ncurses with Ubuntu

Hi, I am new to this programming with ncurses. I want to work out few examples on this ncurses. I jus want to know whether this ncurses works with Ubuntu OS? I found tat ncurses doesn come with AIX OS, may be it could be installed as a SupportPac or something, not sure about it. Can u please... (4 Replies)
Discussion started by: julie_s
4 Replies

6. Programming

Help with ncurses

Help with ncurses Hi, I need some help with ncurses.I'm supposed to write a program in C to display date and time and also to input the username and password using C.I chose ncurses for my task and here I am. Code: #include <stdio.h> #include <termios.h> #include... (1 Reply)
Discussion started by: rakesh_01
1 Replies

7. UNIX for Dummies Questions & Answers

ncurses not in library?

I tried to complile a text-based messenger program but, while configuring, got a message saying that ncurses wasn't found. Though it appears to be there... This is the program: http://sourceforge.net/project/showfiles.php?group_id=110124&package_id=119574&release_id=373164 I get the error... (5 Replies)
Discussion started by: riwa
5 Replies

8. Programming

ncurses refresh()

i have read in one of links, there its documented but i am using following code int main () { char ch; initscr(); printw("Enter a char :"); ch=getch(); printw("You Entered '%c' ",ch); getch(); endwin(); return 0; } the code does... (2 Replies)
Discussion started by: MrUser
2 Replies

9. Programming

Memory sharing with NCURSES

Hey, Im using a shared memory segment to share a WINDOW structure among 2 processes. Basically I'm building a multi-player snake game in which multiple prrocesses access the window. The 'parent' process initializes the shared memory segment and puts the window in it. I can access and perform... (1 Reply)
Discussion started by: dgre0018
1 Replies

10. Programming

[C/Ncurses]Need help on a project

Hi guys I'm a newbie.Got a school project:need to convert Linux Hunt game,which is in K&R C to C99.I got some problems over Ncurses files:new library it's very different from the old one.There are some variables that with gcc are considered undefined 'cause they are no more used in the new Ncurses... (2 Replies)
Discussion started by: fracche
2 Replies
Gtk2::SourceView2::Style(3pm)				User Contributed Perl Documentation			     Gtk2::SourceView2::Style(3pm)

NAME
Gtk2::SourceView2::Style HIERARCHY
Glib::Object +----Gtk2::SourceView2::Style METHODS
style = $style->copy PROPERTIES
'background' (string : default undef : readable / writable / construct-only) Background color 'background-set' (boolean : default false : readable / writable / construct-only) Whether background color is set 'bold' (boolean : default false : readable / writable / construct-only) Bold 'bold-set' (boolean : default false : readable / writable / construct-only) Whether bold attribute is set 'foreground' (string : default undef : readable / writable / construct-only) Foreground color 'foreground-set' (boolean : default false : readable / writable / construct-only) Whether foreground color is set 'italic' (boolean : default false : readable / writable / construct-only) Italic 'italic-set' (boolean : default false : readable / writable / construct-only) Whether italic attribute is set 'line-background' (string : default undef : readable / writable / construct-only) Line background color 'line-background-set' (boolean : default false : readable / writable / construct-only) Whether line background color is set 'strikethrough' (boolean : default false : readable / writable / construct-only) Strikethrough 'strikethrough-set' (boolean : default false : readable / writable / construct-only) Whether strikethrough attribute is set 'underline' (boolean : default false : readable / writable / construct-only) Underline 'underline-set' (boolean : default false : readable / writable / construct-only) Whether underline attribute is set SEE ALSO
Gtk2::SourceView2, Glib::Object COPYRIGHT
Copyright (C) 2009 by Emmanuel Rodriguez perl v5.14.2 2011-11-16 Gtk2::SourceView2::Style(3pm)
All times are GMT -4. The time now is 11:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy