1+ /***********************************************************************
2+ **
3+ ** REBOL [R3] Language Interpreter and Run-time Environment
4+ **
5+ ** Copyright 2012 REBOL Technologies
6+ ** Copyright 2026 Rebol Open Source Developers
7+ ** REBOL is a trademark of REBOL Technologies
8+ **
9+ ** Licensed under the Apache License, Version 2.0 (the "License");
10+ ** you may not use this file except in compliance with the License.
11+ ** You may obtain a copy of the License at
12+ **
13+ ** http://www.apache.org/licenses/LICENSE-2.0
14+ **
15+ ** Unless required by applicable law or agreed to in writing, software
16+ ** distributed under the License is distributed on an "AS IS" BASIS,
17+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+ ** See the License for the specific language governing permissions and
19+ ** limitations under the License.
20+ **
21+ ************************************************************************
22+ **
23+ ** Module: n-request-color.c
24+ ** Summary: native request-color function
25+ ** Section: natives
26+ ** Author: Oldes
27+ ** Notes:
28+ ** So fat it is used only on Windows. On macOS it's implementented
29+ ** as Rebol mezzanine function in file mezz-osx-dialogs.reb
30+ ***********************************************************************/
31+
32+ #include "sys-core.h"
33+
34+ /***********************************************************************
35+ **
36+ */ REBNATIVE (request_color )
37+ /*
38+ // request-color: native [
39+ // {Asks user to select a color.}
40+ // /default "Default RGB color"
41+ // color [tuple!]
42+ // ]
43+ //
44+ ***********************************************************************/
45+ {
46+ #ifdef TO_WINDOWS
47+ static REBYTE color [4 ];
48+ if (D_REF (1 )) {
49+ COPY_MEM (color , VAL_TUPLE (D_ARG (2 )), 4 );
50+ }
51+ if (OS_Request_Color ((REBCNT * )& color )) {
52+ VAL_SET (DS_RETURN , REB_TUPLE );
53+ VAL_TUPLE_LEN (DS_RETURN ) = 3 ;
54+ COPY_MEM (VAL_TUPLE (DS_RETURN ), & color , 4 );
55+ return R_RET ;
56+ }
57+ else return R_NONE ;
58+ #else
59+ Trap0 (RE_FEATURE_NA );
60+ return R_NONE ;
61+ #endif
62+ }
0 commit comments