2016-06-14 3 views
2

vim과 같은 것을 실행중인 터미널에서 커서의 색상을 확인하는 방법이 있습니까? 나는 당신이 tput colstput rows을 터미널의 높이와 너비를 결정하는 데 사용할 수 있다는 것을 알고 있습니다. 커서 색상/현재 터미널의 모든 문자 위치의 ansi 표준 전경색/배경색을 얻는 유사한 도구가 있습니까?터미널에서 커서 색상을 얻으십시오

답변

1

귀하의 질문에 대한 답변은 "아니오, 그렇게 할 수있는 표준 방법이 없습니다."입니다.

터미널은 직렬 포트 또는 모뎀을 통해 서버와 통신 한 고대 텍스트 터미널 (예 : DEC VT100 등)을 모델로 한 것입니다. 그리고 그 터미널은 1960 년대에 컴퓨터에 연결된 TeleTYpe (tty) 장치를 모방하여 모델링되었습니다.

Teletype 컴퓨터 ("벙어리"터미널)는 키보드에 입력되지 않은 서버에 다시 데이터를 제공하지 않았습니다. VT100과 같은 장치 ("스마트"터미널)는 서버에 매우 적은 양을 제공했지만 사용 가능한 목록은 수년 동안 변경되지 않았습니다.

기타 리소스 :

모든 터미널이 VT100/VT220 인 것은 아니며 시스템에 비표준 방식으로 필요한 것을 제공하는 locak 확장이있을 수 있습니다.

추가 판독 값은 man termcapman terminfo입니다. 해당 페이지의 "관련 항목"섹션에서 참조를 확인하십시오.

+0

익명 downvotes 사랑 해요. :-P 누군가가이 대답이 잘못되었거나 잘못되었다고 생각하면 나는 그 이유를 알고 싶다. – ghoti

1

짧은 답변 : 예

긴 대답 : 기능, 널리 사용되는 스크립트에 대한 터미널 기능 중 하나를 검색 할 수 있습니다 tput의 또 다른 기능이 될 것입니다 경우. 그것들은 terminfo manual 페이지에 문서화되어 있습니다. 커서 색을 처리하지 않고 단지 cvvis (매우 보임), cnorm (일반) 및 civis (보이지 않는) 커서 속성 만 사용합니다. 이다

, 대부분의 단말기는

xterm 등이있다 커서 색상을 검색

  • 할 수있는 방법을 제공 커서 색상이나
  • 을 설정 수있는 방법을 제공하지 않습니다 희소 한 예외, 둘 다 제공. 그러나이 기능은 xterm을 모방하는 터미널에서 종종 지원되지 않습니다.그것은 dynamic colors 기능의 한 부분으로 XTerm Control Sequences에 설명되어 있습니다 :

    OSC Ps ; Pt ST 
    OSC Ps ; Pt BEL 
         Set Text Parameters. For colors and font, if Pt is a "?", the 
         control sequence elicits a response which consists of the con- 
         trol sequence which would set the corresponding value. The 
         dtterm control sequences allow you to determine the icon name 
         and window title. 
    
         The 10 colors (below) which may be set or queried using 1 0 
         through 1 9 are denoted dynamic colors, since the correspond- 
         ing control sequences were the first means for setting xterm's 
         colors dynamically, i.e., after it was started. They are not 
         the same as the ANSI colors. These controls may be disabled 
         using the allowColorOps resource. At least one parameter is 
         expected for Pt. Each successive parameter changes the next 
         color in the list. The value of Ps tells the starting point 
         in the list. The colors are specified by name or RGB specifi- 
         cation as per XParseColor. 
    
         If a "?" is given rather than a name or RGB specification, 
         xterm replies with a control sequence of the same form which 
         can be used to set the corresponding dynamic color. Because 
         more than one pair of color number and specification can be 
         given in one control sequence, xterm can make more than one 
         reply. 
    
         Ps = 1 2 -> Change text cursor color to Pt. 
    

    프로그램 xtermcontrol 설정하고 커서 색상을 얻기 위해 이러한 이스케이프 시퀀스를 사용하는 명령 줄 : 예를 들어

    --cursor=COLOR 
        Set cursor color to COLOR. 
    
    --get-cursor 
        Report cursor color. 
    

    $ xtermcontrol --get-cursor 
    rgb:0000/0000/0000 
    $ xtermcontrol --cursor limegreen 
    $ xtermcontrol --get-cursor 
    rgb:3232/cdcd/3232 
    

    가치가있는 경우 VTE에서 지원합니다 (예 : gnome-terminal).

관련 문제