Sign in Join
Wiki copytemporary

Revision 2 of 4, by WikiArchive on 11-4-2026. The page as it is now.

Colors/es

Cambios de Tema

Cuando el usuario cambia el tema, los colores de sistema también cambian. Un clInfoBk puede cambiar de blanco a azul de un color a una textura. Este cambio tendrá lugar cuando habilites un nuevo manejador de brocha (brush). Ten en cuenta que una simple asignación como Brush.Color:=clInfoBk no habilita un manejador de brocha. El manejador de brocha se habilita en uso. Por ejemplo:

pascal
Form1.Canvas.Brush.Color:=clInfoBk; // Esto no creará un nuevo manejador de brocha.
    Form1.Canvas.FillRect(10,10,50,50); // Esto creará el manejador de brocha con la actual brocha del tema activo para ventanas de sugerencia.
    ...
    // Si el tema cambia en este momento el Brush.Handle está todavía establecido con los valores antiguos.
    ...
    Form1.Canvas.FillRect(10,10,50,50); // Esto pintará con la brocha del tema anterior.
    Form1.Canvas.Brush.Color:=clInfoBk; // Asignando el valor antiguo no creará un nuevo manejador de brocha.
    Form1.Canvas.FillRect(10,10,50,50); // Esto pintará con la brocha del tema anterior.
    Form1.Canvas.Brush.Color:=clRed;    // Asignando un color nuevo, invalida manejador (handle) anterior.
    Form1.Canvas.Brush.Color:=clInfoBk; // Asignando un color nuevo, invalida manejador (handle) anterior.
    Form1.Canvas.FillRect(10,10,50,50); // Esto creará un nuevo manejador y pintará con el nuevo tema.

Tabla de colores del sistema

La siguente tabla lista los colores del sistema y su significado. Utilizarlos fuera de lo especificado en la definición no estaría definido y el resultado obtenido depende del widgetset y del tema. Por ejemplo clDefault es el color de fondo para la brocha (brush) en el contexto de dispositivo utilizado. Si lo que necesitas es pintar elementos tipo button en tus propios controles personalizados entonces utiliza las funciones de la unidad Themes.

Constant Definición LCL Notas Delphi Widgetsets Soportados
clNone Indicates "do not paint". Utilizarlos como color de Control no esta definido. El control no será transparente. - todos
clDefault Using it for Brush will use the normal background brush of the target DC (device context).

| - | all
clScrollBar | Scrollbar body | - | all
clBackground | ? | - | all
clActiveCaption | Active window titlebar | - | none
clInactiveCaption | Inactive window titlebar | - | none
clMenu | Regular menu item background color | - | none
clWindow | The normal background brush of unselected text. Defined for controls like TEdit, TComboBox, TMemo, TListBox, TTreeView. | - | none
clWindowFrame | Color of frame around the window | - | none
clMenuText | The font color to use together with clMenu | - | none
clWindowText | Font color to use together with clWindow | - | none
clCaptionText | Active window titlebar text color | - | none
clActiveBorder | ? | - | none
clInactiveBorder | ? | - | none
clAppWorkspace | MDIMain form background | - | none
clHighlight | The brush color of selected element | - | none
clHighlightText | Font color of selected text (to use together with clHighligh). | - | none
clBtnFace | Button background | - | none
clBtnShadow | Button shadow color (bottom right) used to achieve 3D effect | - | none
clGrayText | The font color of disabled element | - | none
clBtnText | Button font color to use together with clBtnFace | - | none
clInactiveCaptionText | Inactive window titlebar text color | - | none
clBtnHighlight | Button highlight color (top left) used to achieve 3D effect | - | none
cl3DDkShadow | ? | - | none
cl3DLight | ? | - | none
clInfoText | Font color for hints. Use together with clInfoBk | - | all
clInfoBk | Brush color for hints. Use together with clInfoText | - | all
clHotLight | ? | - | none
clGradientActiveCaption | The second color used to make gradient of active window titlebar | - | none
clGradientInactiveCaption | The second color used to make gradient for inactive window titlebar | - | none
clMenuHighlight | The background color of selected menu item | - | none
clMenuBar | The Backround color of menu bar | - | none
clForm | ? | - | none
clColorDesktop | ? | - | none
cl3DFace | ? | - | none
cl3DShadow | ? | - | none
cl3DHiLight | ? | - | none
clBtnHiLight | Same as clBtnHighlight | - | none

Dibujando theme elements en tus controles personalizados

La unidad Themes aporta funciones para dibujar elementos individuales de controles estandar. Por ejemplo, para dibujar un signo de expansión como un TTreeView utiliza el siguiente código:

pascal
uses Themes;
    
    ...
    
    procedure TYourCustomControl.Paint;
    const
      PlusMinusDetail: array[Boolean {Hot}, Boolean {Expanded}] of TThemedTreeview =
      (
        (ttGlyphClosed, ttGlyphOpened),
        (ttHotGlyphClosed, ttHotGlyphOpened)
      );
    var
      Details: TThemedElementDetails;
      R: TRect;
      Collapse: boolean;
    begin
      ...
      //draw a themed expand sign.
      Details := ThemeServices.GetElementDetails(PlusMinusDetail[False, Collapse]);
      R := Rect(ALeft, ATop, ARight + 1, ABottom + 1);
      ThemeServices.DrawElement(Canvas.Handle, Details, R, nil);
      ...
    end;

Conversiones de color hacia/desde html


From the Free Pascal wiki, page "Colors/es", as the Internet Archive kept it on 2024-09-20. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.