ncurses_init_pair Define a color pair


ncurses_init_pair

(PHP 4 >= 4.0.7, PHP 5 < 5.3.0, PECL ncurses >= 1.0.0)

ncurses_init_pairDefine a color pair

说明

int ncurses_init_pair ( int $pair , int $fg , int $bg )

Defines or redefines the given color pair to have the given foreground and background colors. If the color pair was previously initialized, the screen is refreshed and all occurrences of it are changed to reflect the new definition.

Color capabilities must be initialized using ncurses_start_color() before calling this function. The first color pair (color pair 0) is assumed to be white on black by default, but can be changed using ncurses_assume_default_colors().

参数

pair

The number of the color pair to define.

fg

The foreground color for the color pair. May be one of the pre-defined colors or one defined by ncurses_init_color() if the terminal has color changing capabilities.

bg

The background color for the color pair. May be one of the pre-defined colors or one defined by ncurses_init_color() if the terminal has color changing capabilities.

返回值

Returns -1 if the function was successful, and 0 if ncurses or color support were not initialized.

注释

Note that color changing capabilities are not required for defining color pairs of pre-existing colors, but only for changing definitions (red, green, and blue components) of colors themselves per ncurses_init_color().

范例

Example #1 Writing a string with a specified color to the screen

<?php
ncurses_init
();

// If the terminal supports colors, initialize and set active color
if (ncurses_has_colors()) {
    
ncurses_start_color();
    
ncurses_init_pair(1NCURSES_COLOR_YELLOWNCURSES_COLOR_BLUE);
    
ncurses_color_set(1);
}

// Write a string at specified location
ncurses_mvaddstr(1010"Hello world! Yellow on blue text!");

// Flush output to screen
ncurses_refresh();

ncurses_end();
?>

参见


«  ncurses_init_color
» ncurses_insch
PHPNcurses - 函数
  • ncurses_addch
  • ncurses_addchnstr
  • ncurses_addchstr
  • ncurses_addnstr
  • ncurses_addstr
  • ncurses_assume_default_colors
  • ncurses_attroff
  • ncurses_attron
  • ncurses_attrset
  • ncurses_baudrate
  • ncurses_beep
  • ncurses_bkgd
  • ncurses_bkgdset
  • ncurses_border
  • ncurses_bottom_panel
  • ncurses_can_change_color
  • ncurses_cbreak
  • ncurses_clear
  • ncurses_clrtobot
  • ncurses_clrtoeol
  • ncurses_color_content
  • ncurses_color_set
  • ncurses_curs_set
  • ncurses_define_key
  • ncurses_def_prog_mode
  • ncurses_def_shell_mode
  • ncurses_delay_output
  • ncurses_delch
  • ncurses_deleteln
  • ncurses_delwin
  • ncurses_del_panel
  • ncurses_doupdate
  • ncurses_echo
  • ncurses_echochar
  • ncurses_end
  • ncurses_erase
  • ncurses_erasechar
  • ncurses_filter
  • ncurses_flash
  • ncurses_flushinp
  • ncurses_getch
  • ncurses_getmaxyx
  • ncurses_getmouse
  • ncurses_getyx
  • ncurses_halfdelay
  • ncurses_has_colors
  • ncurses_has_ic
  • ncurses_has_il
  • ncurses_has_key
  • ncurses_hide_panel
  • ncurses_hline
  • ncurses_inch
  • ncurses_init
  • ncurses_init_color
  • ncurses_init_pair
  • ncurses_insch
  • ncurses_insdelln
  • ncurses_insertln
  • ncurses_insstr
  • ncurses_instr
  • ncurses_isendwin
  • ncurses_keyok
  • ncurses_keypad
  • ncurses_killchar
  • ncurses_longname
  • ncurses_meta
  • ncurses_mouseinterval
  • ncurses_mousemask
  • ncurses_mouse_trafo
  • ncurses_move
  • ncurses_move_panel
  • ncurses_mvaddch
  • ncurses_mvaddchnstr
  • ncurses_mvaddchstr
  • ncurses_mvaddnstr
  • ncurses_mvaddstr
  • ncurses_mvcur
  • ncurses_mvdelch
  • ncurses_mvgetch
  • ncurses_mvhline
  • ncurses_mvinch
  • ncurses_mvvline
  • ncurses_mvwaddstr
  • ncurses_napms
  • ncurses_newpad
  • ncurses_newwin
  • ncurses_new_panel
  • ncurses_nl
  • ncurses_nocbreak
  • ncurses_noecho
  • ncurses_nonl
  • ncurses_noqiflush
  • ncurses_noraw
  • ncurses_pair_content
  • ncurses_panel_above
  • ncurses_panel_below
  • ncurses_panel_window
  • ncurses_pnoutrefresh
  • ncurses_prefresh
  • ncurses_putp
  • ncurses_qiflush
  • ncurses_raw
  • ncurses_refresh
  • ncurses_replace_panel
  • ncurses_resetty
  • ncurses_reset_prog_mode
  • ncurses_reset_shell_mode
  • ncurses_savetty
  • ncurses_scrl
  • ncurses_scr_dump
  • ncurses_scr_init
  • ncurses_scr_restore
  • ncurses_scr_set
  • ncurses_show_panel
  • ncurses_slk_attr
  • ncurses_slk_attroff
  • ncurses_slk_attron
  • ncurses_slk_attrset
  • ncurses_slk_clear
  • ncurses_slk_color
  • ncurses_slk_init
  • ncurses_slk_noutrefresh
  • ncurses_slk_refresh
  • ncurses_slk_restore
  • ncurses_slk_set
  • ncurses_slk_touch
  • ncurses_start_color
  • ncurses_termattrs
  • ncurses_termname
  • ncurses_timeout
  • ncurses_top_panel
  • ncurses_typeahead
  • ncurses_ungetch
  • ncurses_ungetmouse
  • ncurses_update_panels
  • ncurses_use_default_colors
  • ncurses_use_env
  • ncurses_use_extended_names
  • ncurses_vidattr
  • ncurses_vline
  • ncurses_waddch
  • ncurses_waddstr
  • ncurses_wattroff
  • ncurses_wattron
  • ncurses_wattrset
  • ncurses_wborder
  • ncurses_wclear
  • ncurses_wcolor_set
  • ncurses_werase
  • ncurses_wgetch
  • ncurses_whline
  • ncurses_wmouse_trafo
  • ncurses_wmove
  • ncurses_wnoutrefresh
  • ncurses_wrefresh
  • ncurses_wstandend
  • ncurses_wstandout
  • ncurses_wvline
  • 快速导航

    Copyright © 2016 phpStudy | 豫ICP备2021030365号-3